Sha256: 60ae1e1494f8ba3b3fd8cddcf2b6ae251b4dfa5c93f14cf42ae56c0b82fdd6f2

Contents?: true

Size: 1.41 KB

Versions: 38

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path('../../../test_helper', __FILE__)

module Maestrano
  module SSO
    class GroupTest < Test::Unit::TestCase
      setup do
        @group = mock('group')
        class << @group
          include Maestrano::SSO::Group
        end
      end
  
      context "find_for_maestrano_auth" do
        should "raise an error if not overriden" do
          assert_raise(NoMethodError.new("You need to override find_for_maestrano_auth in your Mocha::Mock model")) do
            @group.find_for_maestrano_auth({})
          end
        end
    
        should "execute properly otherwise" do
          def @group.find_for_maestrano_auth(auth); return true; end
          assert_nothing_thrown do
            @group.find_for_maestrano_auth({})
          end
        end
      end
  
      context "maestrano?" do
        should "raise an error if no provider attribute and not overriden" do
          assert_raise(NoMethodError.new("You need to override maestrano? in your Mocha::Mock model")) do
            @group.maestrano?
          end
        end
    
        should "return true if the provider is 'maestrano'" do
          @group.stubs(:provider).returns('maestrano')
          assert @group.maestrano?
        end
    
        should "return false if the provider is something else" do
          @group.stubs(:provider).returns('someprovider')
          assert !@group.maestrano?
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
maestrano-1.0.6 test/maestrano/sso/group_test.rb
maestrano-1.0.5 test/maestrano/sso/group_test.rb
maestrano-1.0.4 test/maestrano/sso/group_test.rb
maestrano-1.0.3 test/maestrano/sso/group_test.rb
maestrano-1.0.2 test/maestrano/sso/group_test.rb
maestrano-1.0.1 test/maestrano/sso/group_test.rb
maestrano-1.0.0 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC9 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC8 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC7 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC6 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC5 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC4 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC3 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC2 test/maestrano/sso/group_test.rb
maestrano-1.0.0.pre.RC1 test/maestrano/sso/group_test.rb
maestrano-0.12.5 test/maestrano/sso/group_test.rb
maestrano-0.12.4 test/maestrano/sso/group_test.rb
maestrano-0.12.3 test/maestrano/sso/group_test.rb
maestrano-0.12.2 test/maestrano/sso/group_test.rb