]> git.openstreetmap.org Git - rails.git/blob - vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb
Merged 17073:17076 from trunk.
[rails.git] / vendor / plugins / oauth-plugin / generators / oauth_provider / templates / oauth_nonce_spec.rb
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'oauth/helper'
3 describe OauthNonce do
4   include OAuth::Helper
5   before(:each) do
6     @oauth_nonce = OauthNonce.remember(generate_key, Time.now.to_i)
7   end
8
9   it "should be valid" do
10     @oauth_nonce.should be_valid
11   end
12   
13   it "should not have errors" do
14     @oauth_nonce.errors.full_messages.should == []
15   end
16   
17   it "should not be a new record" do
18     @oauth_nonce.should_not be_new_record
19   end
20   
21   it "should not allow a second one with the same values" do
22     OauthNonce.remember(@oauth_nonce.nonce,@oauth_nonce.timestamp).should == false
23   end
24 end