Sha256: d0f07ed9ac526aec8dc63e375ceb0098fd0999870153070f6b9f2dec913a7138

Contents?: true

Size: 606 Bytes

Versions: 6

Compression:

Stored size: 606 Bytes

Contents

require 'spec_helper'

describe GreenFlag::UserGroup do

  let(:visitor) { double(user: nil) }

  # includes noone
  let(:exclusive_user_group) { GreenFlag::UserGroup.new('Foo') { false } }

  # includes everyone
  let(:inclusive_user_group) { GreenFlag::UserGroup.new('Foo') { true } }

  describe '#includes_visitor?' do
    subject { inclusive_user_group.includes_visitor?(visitor) }
    context 'when the visitor has no user' do
      it { should be_false }
    end
    context 'when the visitor has a user' do
      let(:visitor) { double(user: double) }
      it { should be_true }
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
green_flag-0.4.0 spec/models/green_flag/user_group_spec.rb
green_flag-0.3.0 spec/models/green_flag/user_group_spec.rb
green_flag-0.2.0 spec/models/green_flag/user_group_spec.rb
green_flag-0.1.2 spec/models/green_flag/user_group_spec.rb
green_flag-0.1.1 spec/models/green_flag/user_group_spec.rb
green_flag-0.1.0 spec/models/green_flag/user_group_spec.rb