Sha256: 5bbce6ab3e5df1a1da2ecd42713913bc01850491635bda7a1a918b7ff83cd1f6

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

require 'spec_helper'

describe Warden::GitHub::Rails::TestHelpers::MockUser do
  it { is_expected.to be_a Warden::GitHub::User }

  describe '#stub_membership' do
    subject(:user) { described_class.new }

    it 'stubs memberships' do
      expect(user).not_to be_team_member(123)
      expect(user).not_to be_team_member(456)
      expect(user).not_to be_organization_member('foobar')

      user.stub_membership(org: 'foobar', team: [123, '456'])

      expect(user).to be_team_member(123)
      expect(user).to be_team_member(456)
      expect(user).to be_organization_member('foobar')
    end
  end

  it 'can be marshaled' do
    user = described_class.new
    user.stub_membership(org: ['apple', 'facebook'], team: [12, 34])
    marshaled_user = Marshal.load(Marshal.dump(user))

    expect(marshaled_user.memberships).to eq(user.memberships)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
warden-github-rails-1.2.2 spec/unit/mock_user_spec.rb
warden-github-rails-1.2.1 spec/unit/mock_user_spec.rb
warden-github-rails-1.2.0 spec/unit/mock_user_spec.rb
warden-github-rails-1.1.2 spec/unit/mock_user_spec.rb