diff --git a/spec/cocoon_spec.rb b/spec/cocoon_spec.rb
index 962a898..069f4e8 100644
--- a/spec/cocoon_spec.rb
+++ b/spec/cocoon_spec.rb
@@ -19,12 +19,12 @@ describe Cocoon do
end
context "without a block" do
- it "should accept a name" do
+ it "accepts a name" do
result = @tester.link_to_add_association('add something', @form_obj, :comments)
result.to_s.should == 'add something'
end
- it "should accept html options and pass them to link_to" do
+ it "accepts html options and pass them to link_to" do
result = @tester.link_to_add_association('add something', @form_obj, :comments, {:class => 'something silly'})
result.to_s.should == 'add something'
end
@@ -38,7 +38,7 @@ describe Cocoon do
result.to_s.should == 'some long name'
end
- it "should accept html options and pass them to link_to" do
+ it "accepts html options and pass them to link_to" do
result = @tester.link_to_add_association(@form_obj, :comments, {:class => 'floppy disk'}) do
"some long name"
end
@@ -48,7 +48,7 @@ describe Cocoon do
end
context "with an irregular plural" do
- it "should use the correct plural" do
+ it "uses the correct plural" do
result = @tester.link_to_add_association('add something', @form_obj, :people)
result.to_s.should == 'add something'
end
@@ -59,7 +59,7 @@ describe Cocoon do
end
context "with extra render-options for rendering the child relation" do
- it "should use the correct plural" do
+ it "uses the correct plural" do
@tester.should_receive(:render_association).with(:people, @form_obj, anything, {:wrapper => 'inline'}, nil)
result = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline'})
result.to_s.should == 'add something'
@@ -105,13 +105,13 @@ describe Cocoon do
@form_obj = stub(:object => @post, :object_name => @post.class.name)
end
- context "without a block" do
- it "should accept a name" do
+ context "without a block" do
+ it "accepts a name" do
result = @tester.link_to_remove_association('remove something', @form_obj)
result.to_s.should == "remove something"
end
- it "should accept html options and pass them to link_to" do
+ it "accepts html options and pass them to link_to" do
result = @tester.link_to_remove_association('remove something', @form_obj, {:class => 'add_some_class', :'data-something' => 'bla'})
result.to_s.should == "remove something"
end
@@ -126,7 +126,7 @@ describe Cocoon do
result.to_s.should == "remove some long name"
end
- it "should accept html options and pass them to link_to" do
+ it "accepts html options and pass them to link_to" do
result = @tester.link_to_remove_association(@form_obj, {:class => 'add_some_class', :'data-something' => 'bla'}) do
"remove some long name"
end
@@ -141,10 +141,12 @@ describe Cocoon do
end
end
- context "should create proper partial" do
- it "should create correct association" do
+ context "setup_partial" do
+ it "generates the default partial name if no partial given" do
result = @tester.setup_partial(nil, :admin_comments)
result.should == "admin_comment_fields"
+ end
+ it "uses the given partial name" do
result = @tester.setup_partial("comment_fields", :admin_comments)
result.should == "comment_fields"
end