Re: [rspec-users] stubbing mongoid::criteria in view code

2011-03-25 Thread Michael B. Klein
What happens if you Page.stub_chain(:criteria, :id).and_return([mock_model("Page", :title => "foobar")]) (i.e., replace the mocked MongoidCriteria with a single-element Array containing the mocked Page) On Fri, Mar 25, 2011 at 8:18 AM, amkirwan wrote: > no unfortunately that does not work eith

Re: [rspec-users] How do I use expect{}.to change().from().to() on Array?

2011-03-25 Thread niku -E:)
finally, I solved this code. require 'rspec' class Ary attr_reader :ary def initialize @count = 0 @ary = [] increment end def increment @ary << @count @count += 1 end end describe Ary, "#ary" do subject{ Ary.new } it "should increment the ary" do # expect { subject.in

Re: [rspec-users] stubbing mongoid::criteria in view code

2011-03-25 Thread amkirwan
no unfortunately that does not work either. I receive the error: undefined method `title' for #___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users