Fixed the tests.

This commit is contained in:
nathanvda 2011-06-18 01:40:35 +02:00
parent 1390d07550
commit 388b10a7e5

View File

@ -21,12 +21,12 @@ describe Cocoon do
context "without a block" do context "without a block" do
it "should accept a name" do it "should accept a name" do
result = @tester.link_to_add_association('add something', @form_obj, :comments) result = @tester.link_to_add_association('add something', @form_obj, :comments)
result.to_s.should == '<a href="#" class="add_fields" data-association="comment" data-associations="comments" data-template="form&amp;lt;tag&amp;gt;">add something</a>' result.to_s.should == '<a href="#" class="add_fields" data-association="comment" data-associations="comments" data-template="form&lt;tag&gt;">add something</a>'
end end
it "should accept html options and pass them to link_to" do it "should accept html options and pass them to link_to" do
result = @tester.link_to_add_association('add something', @form_obj, :comments, {:class => 'something silly'}) result = @tester.link_to_add_association('add something', @form_obj, :comments, {:class => 'something silly'})
result.to_s.should == '<a href="#" class="something silly add_fields" data-association="comment" data-associations="comments" data-template="form&amp;lt;tag&amp;gt;">add something</a>' result.to_s.should == '<a href="#" class="something silly add_fields" data-association="comment" data-associations="comments" data-template="form&lt;tag&gt;">add something</a>'
end end
end end
@ -35,14 +35,14 @@ describe Cocoon do
result = @tester.link_to_add_association(@form_obj, :comments) do result = @tester.link_to_add_association(@form_obj, :comments) do
"some long name" "some long name"
end end
result.to_s.should == '<a href="#" class="add_fields" data-association="comment" data-associations="comments" data-template="form&amp;lt;tag&amp;gt;">some long name</a>' result.to_s.should == '<a href="#" class="add_fields" data-association="comment" data-associations="comments" data-template="form&lt;tag&gt;">some long name</a>'
end end
it "should accept html options and pass them to link_to" do it "should accept html options and pass them to link_to" do
result = @tester.link_to_add_association(@form_obj, :comments, {:class => 'floppy disk'}) do result = @tester.link_to_add_association(@form_obj, :comments, {:class => 'floppy disk'}) do
"some long name" "some long name"
end end
result.to_s.should == '<a href="#" class="floppy disk add_fields" data-association="comment" data-associations="comments" data-template="form&amp;lt;tag&amp;gt;">some long name</a>' result.to_s.should == '<a href="#" class="floppy disk add_fields" data-association="comment" data-associations="comments" data-template="form&lt;tag&gt;">some long name</a>'
end end
end end
@ -50,7 +50,7 @@ describe Cocoon do
context "with an irregular plural" do context "with an irregular plural" do
it "should use the correct plural" do it "should use the correct plural" do
result = @tester.link_to_add_association('add something', @form_obj, :people) result = @tester.link_to_add_association('add something', @form_obj, :people)
result.to_s.should == '<a href="#" class="add_fields" data-association="person" data-associations="people" data-template="form&amp;lt;tag&amp;gt;">add something</a>' result.to_s.should == '<a href="#" class="add_fields" data-association="person" data-associations="people" data-template="form&lt;tag&gt;">add something</a>'
end end
end end