Sha256: 1bc9bd355233b2eb96e619b0402d0130971e4e9bfbcedc112e6996a24219430f
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require 'spec_helper' describe Oauth2Provider::OauthToken do before { @token = FactoryGirl.create(:oauth_token) } subject { @token } it { should validate_presence_of(:client_uri) } it { VALID_URIS.each{|uri| should allow_value(uri).for(:client_uri) } } it { should validate_presence_of(:resource_owner_uri) } it { VALID_URIS.each{|uri| should allow_value(uri).for(:resource_owner_uri) } } its(:token) { should_not be_nil } its(:refresh_token) { should_not be_nil } it { should_not be_blocked } context "#block!" do before { subject.block! } it { should be_blocked } end context ".block_client!" do before { @another_client_token = FactoryGirl.create(:oauth_token, client_uri: ANOTHER_CLIENT_URI) } before { Oauth2Provider::OauthToken.block_client!(CLIENT_URI) } it { @token.reload.should be_blocked } it { @another_client_token.should_not be_blocked } end context ".block_access!" do before { @another_client_token = FactoryGirl.create(:oauth_token, client_uri: ANOTHER_CLIENT_URI)} before { @another_owner_token = FactoryGirl.create(:oauth_token, resource_owner_uri: ANOTHER_USER_URI) } before { Oauth2Provider::OauthToken.block_access!(CLIENT_URI, USER_URI) } it { @token.reload.should be_blocked } it { @another_client_token.should_not be_blocked } it { @another_owner_token.should_not be_blocked } end context ".exist" do it "should find the token" do existing = Oauth2Provider::OauthToken.exist(@token.client_uri, @token.resource_owner_uri, @token.scope).first existing.should_not be_nil end end it "#expired?" do subject.should_not be_expired Delorean.time_travel_to("in #{Oauth2Provider.settings["token_expires_in"]} seconds") subject.should be_expired end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
oauth2_provider_engine-0.0.2 | test/dummy/spec/models/oauth/oauth_token_spec.rb |
oauth2_provider_engine-0.0.1 | test/dummy/spec/models/oauth/oauth_token_spec.rb |