diff --git a/spec/cocoon_spec.rb b/spec/cocoon_spec.rb index 46f5231..5881bd6 100644 --- a/spec/cocoon_spec.rb +++ b/spec/cocoon_spec.rb @@ -21,19 +21,19 @@ describe Cocoon do context "without a block" do it "accepts a name" do result = @tester.link_to_add_association('add something', @form_obj, :comments) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end 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' + result.to_s.should == 'add something' end it "allows to explicitly hand the wanted partial" do @tester.unstub(:render_association) @tester.should_receive(:render_association).with(anything(), anything(), anything(), anything(), "shared/partial").and_return('partiallll') result = @tester.link_to_add_association('add something', @form_obj, :comments, :partial => "shared/partial") - result.to_s.should == 'add something' + result.to_s.should == 'add something' end end @@ -42,14 +42,14 @@ describe Cocoon do result = @tester.link_to_add_association(@form_obj, :comments) do "some long name" end - result.to_s.should == 'some long name' + result.to_s.should == 'some long name' end 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 - result.to_s.should == 'some long name' + result.to_s.should == 'some long name' end it "allows to explicitly hand the wanted partial" do @@ -58,21 +58,21 @@ describe Cocoon do result = @tester.link_to_add_association( @form_obj, :comments, :class => 'floppy disk', :partial => "shared/partial") do "some long name" end - result.to_s.should == 'some long name' + result.to_s.should == 'some long name' end end context "with an irregular 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' + result.to_s.should == 'add something' end end context "when using aliased association and class-name" do it "uses the correct name" do result = @tester.link_to_add_association('add something', @form_obj, :admin_comments) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end end @@ -84,7 +84,7 @@ describe Cocoon 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' + result.to_s.should == 'add something' end end @@ -94,14 +94,14 @@ describe Cocoon do @form_obj.should_receive(:fields_for) { | association, new_object, options_hash, &block| block.call } @tester.should_receive(:render).with("person_fields", {:f=>nil, :dynamic=>true, :alfred=>"Judoka"}).and_return ("partiallll") result = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline', :locals => {:alfred => 'Judoka'}}) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end it "if no locals are given it still works" do @tester.unstub(:render_association) @form_obj.should_receive(:fields_for) { | association, new_object, options_hash, &block| block.call } @tester.should_receive(:render).with("person_fields", {:f=>nil, :dynamic=>true}).and_return ("partiallll") result = @tester.link_to_add_association('add something', @form_obj, :people, :render_options => {:wrapper => 'inline'}) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end end @@ -116,7 +116,7 @@ describe Cocoon do @form_obj.should_receive(:semantic_fields_for) @form_obj.should_receive(:fields_for).never result = @tester.link_to_add_association('add something', @form_obj, :people) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end end @@ -132,7 +132,7 @@ describe Cocoon do @form_obj.should_receive(:simple_fields_for) @form_obj.should_receive(:fields_for).never result = @tester.link_to_add_association('add something', @form_obj, :people) - result.to_s.should == 'add something' + result.to_s.should == 'add something' end end