Robert, your changes to rescind make the test fail, but it works fine with
my version.  That's why I took out the extra parameter before.  Should I
switch it back to my method?


On Sun, Sep 22, 2013 at 8:57 PM, Robert Fletcher
<notifications@github.com>wrote:

> In spec/models/token_spec.rb:
>
> > +  let(:token) { Token.create!({:action => 'test', :user => Factory.create(:user)}) }
> > +
> > +  before(:each) { token.user_id = 1 }
> > +
> > +  describe '#before_create' do
> > +    it "should set token value" do
> > +      ActiveSupport::SecureRandom.
> stub(:hex).and_return('hex')
> > +      token.before_create
> > +      token.value.should == 'hex'
> > +    end
> > +
> > +    it "should delete previous matching tokens" do
> > +      previous = Token.create!({:action => 'test delete_previous_tokens', :created_at => Time.now - 1.hour, :user_id => 2})
> > +      previous.save
> > +      Token.create!({:action => 'test delete_previous_tokens', :user_id => 2})
> > +      Token.find_by_id(previous.id).should == nil
>
> This is really good stuff. You learn fast.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mockdeep/better/pull/15/files#r6507691>
> .
>