Permalink
Browse files

Fix testsuite to match use of :all.

One test is still failing, checking to see if :all supports :include syntax
  • Loading branch information...
1 parent ec0cdb4 commit 2f279755c2537fdc0c6af3a932a0b96090813237 @yabawock yabawock committed Aug 7, 2010
Showing with 6 additions and 4 deletions.
  1. +3 −3 spec/inputs/select_input_spec.rb
  2. +2 −0 spec/spec_helper.rb
  3. +1 −1 spec/support/custom_macros.rb
View
6 spec/inputs/select_input_spec.rb
@@ -188,7 +188,7 @@
it "should call author.find with association conditions" do
::Author.should_receive(:merge_conditions).with({:active => true}, nil).and_return(:active => true)
- ::Author.should_receive(:find).with(:all, :conditions => {:active => true})
+ ::Author.should_receive(:all).with(:conditions => {:active => true})
semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => :select))
@@ -197,7 +197,7 @@
it "should call author.find with association conditions and find_options conditions" do
::Author.should_receive(:merge_conditions).with({:active => true}, {:publisher => true}).and_return(:active => true, :publisher => true)
- ::Author.should_receive(:find).with(:all, :conditions => {:active => true, :publisher => true})
+ ::Author.should_receive(:all).with(:conditions => {:active => true, :publisher => true})
semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => :select, :find_options => {:conditions => {:publisher => true}}))
@@ -259,7 +259,7 @@
end
it 'should call find with :include for more optimized queries' do
- Author.should_receive(:find).with(:all, :include => :continent)
+ Author.should_receive(:all).with(:include => :continent)
semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => :select, :group_by => :continent ) )
View
2 spec/spec_helper.rb
@@ -151,6 +151,7 @@ def new_author_path; "/authors/new"; end
::Author.stub!(:find).and_return([@fred, @bob])
+ ::Author.stub!(:all).and_return([@fred, @bob])
::Author.stub!(:to_ary)
::Author.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
::Author.stub!(:human_name).and_return('::Author')
@@ -215,6 +216,7 @@ def new_author_path; "/authors/new"; end
end
::Post.stub!(:find).and_return([@freds_post])
+ ::Post.stub!(:all).and_return([@freds_post])
::Post.stub!(:content_columns).and_return([mock('column', :name => 'title'), mock('column', :name => 'body'), mock('column', :name => 'created_at')])
::Post.stub!(:to_key).and_return(nil)
::Post.stub!(:persisted?).and_return(nil)
View
2 spec/support/custom_macros.rb
@@ -244,7 +244,7 @@ def it_should_apply_error_logic_for_input_type(type)
def it_should_call_find_on_association_class_when_no_collection_is_provided(as)
it "should call find on the association class when no collection is provided" do
- ::Author.should_receive(:find)
+ ::Author.should_receive(:all)
form = semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => as))
end

0 comments on commit 2f27975

Please sign in to comment.