Sha256: 4497e6b9247406c853471290005aec09220375f915e27433d71ec08cccec8f35
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'test_helper' class OmniauthableTest < ActiveSupport::TestCase setup do @omniauth = {provider: 'development', uid: 'foo'} end should "create user from omniauth" do User.any_instance.expects(:fill_with_omniauth).with(@omniauth) Authentication.any_instance.expects(:fill_with_omniauth).with(@omniauth) u = nil assert_difference ['User.count', 'Authentication.count'], 1 do u = User.create_with_omniauth!(@omniauth) end u.reload assert u assert u.activated? assert u.authentications.present? end should "not create user from omniauth when provider and uid are duplicated" do User.create_with_omniauth!(@omniauth) assert_raise ActiveRecord::RecordInvalid do User.create_with_omniauth!(@omniauth) end end should "have any number of authentications" do u = User.create_with_omniauth!(@omniauth) assert_difference 'Authentication.count', 2 do u.authentications << Authentication.build_with_omniauth({provider: 'developer', uid: 'bar'}) u.authentications << Authentication.build_with_omniauth({provider: 'another-service', uid: 'foo'}) u.save! end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
goma-0.0.1.rc3 | test/models/omniauthable_test.rb |
goma-0.0.1.rc2 | test/models/omniauthable_test.rb |
goma-0.0.1.rc1 | test/models/omniauthable_test.rb |