Fix weird error in jasmine suite
This commit is contained in:
parent
5cea922cb8
commit
f0f388d9e1
3 changed files with 12 additions and 7 deletions
|
|
@ -68,8 +68,6 @@ describe AspectsController do
|
||||||
3.times { bob.comment("what", :post => message) }
|
3.times { bob.comment("what", :post => message) }
|
||||||
get :index
|
get :index
|
||||||
save_fixture(html_for("body"), "aspects_index_with_posts")
|
save_fixture(html_for("body"), "aspects_index_with_posts")
|
||||||
|
|
||||||
save_fixture(html_for(".stream_element:first"), "status_message_in_stream")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with getting_started = true' do
|
context 'with getting_started = true' do
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,13 @@ describe StatusMessagesController do
|
||||||
json['html'].should_not be_nil
|
json['html'].should_not be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'saves the html as a fixture', :fixture => true do
|
||||||
|
post :create, status_message_hash.merge(:format => 'js')
|
||||||
|
json = JSON.parse(response.body)
|
||||||
|
save_fixture(json['html'], "created_status_message")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
it 'escapes XSS' do
|
it 'escapes XSS' do
|
||||||
xss = "<script> alert('hi browser') </script>"
|
xss = "<script> alert('hi browser') </script>"
|
||||||
post :create, status_message_hash.merge(:format => 'js', :text => xss)
|
post :create, status_message_hash.merge(:format => 'js', :text => xss)
|
||||||
|
|
|
||||||
|
|
@ -13,21 +13,21 @@ describe("ContentUpdater", function() {
|
||||||
|
|
||||||
it("adds a post to the stream", function() {
|
it("adds a post to the stream", function() {
|
||||||
var originalPostCount = $(".stream_element").length;
|
var originalPostCount = $(".stream_element").length;
|
||||||
ContentUpdater.addPostToStream(spec.fixtureHtml("status_message_in_stream"));
|
ContentUpdater.addPostToStream(spec.fixtureHtml("created_status_message"));
|
||||||
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("does not add duplicate posts", function() {
|
it("does not add duplicate posts", function() {
|
||||||
var originalPostCount = $(".stream_element").length;
|
var originalPostCount = $(".stream_element").length;
|
||||||
ContentUpdater.addPostToStream(spec.fixtureHtml("status_message_in_stream"));
|
ContentUpdater.addPostToStream(spec.fixtureHtml("created_status_message"));
|
||||||
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
||||||
ContentUpdater.addPostToStream(spec.fixtureHtml("status_message_in_stream"));
|
ContentUpdater.addPostToStream(spec.fixtureHtml("created_status_message"));
|
||||||
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
expect($(".stream_element").length).toEqual(originalPostCount + 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("removes the div that says you have no posts if it exists", function() {
|
it("removes the div that says you have no posts if it exists", function() {
|
||||||
expect($("#no_posts").length).toEqual(1);
|
expect($("#no_posts").length).toEqual(1);
|
||||||
ContentUpdater.addPostToStream(spec.fixtureHtml("status_message_in_stream"));
|
ContentUpdater.addPostToStream(spec.fixtureHtml("created_status_message"));
|
||||||
expect($("#no_posts").length).toEqual(0);
|
expect($("#no_posts").length).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue