Re: [rspec-users] Stubbing Scopes

2011-02-24 Thread Christoph Schiessl
So... I settled for testing with message expectations without return values. Guess that's good enough for now. Thank you anyway! Best regards, Christoph Schiessl On Feb 15, 2011, at 21:34 , Justin Ko wrote: > > > On Feb 15, 11:14 am, Christoph Schiessl wrote: >> Thanks for your suggestion J

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Justin Ko
On Feb 15, 11:14 am, Christoph Schiessl wrote: > Thanks for your suggestion Justin, but I don't believe that the problem is > time zone related. Time objects usually don't "loose" their Time Zone when > performing operations on them. Here's an example for illustration: > > $ rails console > Lo

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Christoph Schiessl
Thanks for your suggestion Justin, but I don't believe that the problem is time zone related. Time objects usually don't "loose" their Time Zone when performing operations on them. Here's an example for illustration: $ rails console Loading development environment (Rails 3.0.4) ruby-1.8.7-p330 :

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Justin Ko
Your expectation (should_receive) is expecting "start_of_day", which uses Time.zone. The actual "on_day" scope does "day.to_time.beginning_of_day", which does not use any time zone. Therefore, the arguments to in_interval are not the same as the expectation. And because they are not the same, the m

[rspec-users] Stubbing Scopes

2011-02-15 Thread Christoph Schiessl
Hi! I'm trying to test the following (simplified) model: class Allocation < ActiveRecord::Base scope :in_interval, (proc do |start_of_interval, end_of_interval| params = {:s => start_of_interval, :e => end_of_interval} where("(starts_at > :s AND starts_at < :e) OR (ends_at > :s AND ends