Sha256: 85d741f40e6e1d0356328e5fe85ca55abd3e617dca905b214b858f702d7dbfc9
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
require 'spec_helper' describe Models::Authentication do it { should validate_presence_of(:application_id) } it { should validate_presence_of(:omniauth) } it { should validate_presence_of(:provider) } it { should validate_presence_of(:uid) } it { should validate_presence_of(:user_id) } it { should ensure_length_of(:provider).is_at_most(128) } it { should ensure_length_of(:uid).is_at_most(1024) } it { should belong_to(:user) } it { subject.class.table_name.should == 'restpack_authentications' } let(:application_id) { 123 } let(:omniauth) { { 'provider' => 'twitter', 'uid' => 'gavinjoyce', 'email' => 'gavinjoyce@gmail.com' } } describe '#from_omniauth' do it "constructs a new Authentication" do authentication = subject.class.from_omniauth(application_id, omniauth) authentication.id.should == nil authentication.application_id.should == application_id authentication.provider.should == 'twitter' authentication.uid.should == 'gavinjoyce' authentication.omniauth.should == omniauth end end describe '#get_from_omniauth' do context "a valid omniauth" do before do @user_id = 999 @auth = subject.class.from_omniauth(application_id, omniauth) @auth.user_id = @user_id @auth.save! end it "returns the correct authentication" do auth = subject.class.get_by_omniauth(application_id, @auth.omniauth) auth.id.should == @auth.id auth.user_id.should == @user_id end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restpack_user_service-0.0.4 | spec/models/authentication_spec.rb |