My method looks like:

def self.can_do_this(user)
  return false if user.nil?
  (  (Time.now >= user.created_at) ? true : false  )
end

my spec:

it "should allow you to do this" do
  user = stub("user")
  user.stub(:nil?).and_return(false)
  user.stub(:created_at).and_return(Time.now)

  res = User.can_do_this(user)
  res.should == true
end

Running the spec I get:

Failer/Error: res = User.can_do_this(user)
Stub "user" received unexpected message :created_at with (no args)


Any ideas?

Thanks allot for the help!
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to