Created
February 20, 2012 17:36
-
-
Save jonstorer/1870227 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Client, ".visit" do | |
subject { Factory(:client) } | |
let(:time) { Time.now } | |
it "creates a sign in timestamp if the client has not visited today" do | |
subject.stubs(:has_visited_today? => false) | |
subject.signin_timestamps.each(&:destroy) | |
Timecop.travel(time){ subject.visit } | |
subject.signin_timestamps.count.should == 1 | |
subject.signin_timestamps.first.created_at.utc.to_s.should == time.utc.to_s | |
end | |
it "does not create a sign in timestamp if the client visited today" do | |
subject.stubs(:has_visited_today? => true) | |
subject.visit | |
subject.signin_timestamps.count.should == 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment