Sha256: 79c428930677595901343289a69235c7f5bc69a02c345ca51bf4016fdab6fb6d

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

module Warden
  module GitHub
    module Rails
      module TestHelpers
        class MockUser < User
          attr_reader :memberships

          def initialize(*args)
            super
            @memberships = { :team => [], :org => [] }
          end

          def stub_membership(membership)
            memberships.fetch(membership.keys.first) << membership.values.first
          end

          def team_member?(id)
            memberships[:team].include?(id)
          end

          def organization_member?(id)
            memberships[:org].include?(id)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
warden-github-rails-1.0.0 lib/warden/github/rails/test_helpers/mock_user.rb
warden-github-rails-0.0.1 lib/warden/github/rails/test_helpers/mock_user.rb