X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/fa11baf5c348d6eb4ca00d6d15cf9893626fa2d6..406b46e49b786fab879286d77735b2a16c1cfcc5:/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb diff --git a/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb new file mode 100644 index 000000000..7829bdc74 --- /dev/null +++ b/vendor/plugins/oauth-plugin/generators/oauth_provider/templates/oauth_nonce_spec.rb @@ -0,0 +1,24 @@ +require File.dirname(__FILE__) + '/../spec_helper' +require 'oauth/helper' +describe OauthNonce do + include OAuth::Helper + before(:each) do + @oauth_nonce = OauthNonce.remember(generate_key, Time.now.to_i) + end + + it "should be valid" do + @oauth_nonce.should be_valid + end + + it "should not have errors" do + @oauth_nonce.errors.full_messages.should == [] + end + + it "should not be a new record" do + @oauth_nonce.should_not be_new_record + end + + it "should not allow a second one with the same values" do + OauthNonce.remember(@oauth_nonce.nonce,@oauth_nonce.timestamp).should == false + end +end