Created
May 24, 2012 04:08
-
-
Save dpaola2/2779364 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
require "./spec/spec_helper" | |
describe User do | |
describe "#generate_api_key!" do | |
fixtures :users | |
it "generates a key if one doesn't exist" do | |
user = users(:bob) | |
user.api_key.should be_nil | |
user.generate_api_key! | |
user.api_key.should_not be_nil | |
user.should be_persisted | |
end | |
it "does not generate a key if one exists" do | |
user = users(:bob) | |
user.update_attribute(:api_key, "some-key") | |
user.generate_api_key! | |
user.api_key.should == "some-key" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment