Sha256: 455bff2e1827216000824114b77081a7ceb17168ce2d1a68636fe510e6f82845

Contents?: true

Size: 777 Bytes

Versions: 9

Compression:

Stored size: 777 Bytes

Contents

require 'helper'
require 'flipper/types/group'

describe Flipper::Types::Group do
  subject do
    Flipper::Types::Group.new(:admins) { |actor| actor.admin? }
  end

  it "initializes with name" do
    group = Flipper::Types::Group.new(:admins)
    group.should be_instance_of(Flipper::Types::Group)
  end

  describe "#name" do
    it "returns name" do
      subject.name.should eq(:admins)
    end
  end

  describe "#match?" do
    let(:admin_actor) { double('Actor', :admin? => true) }
    let(:non_admin_actor) { double('Actor', :admin? => false) }

    it "returns true if block matches" do
      subject.match?(admin_actor).should be_true
    end

    it "returns false if block does not match" do
      subject.match?(non_admin_actor).should be_false
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
flipper-0.6.1 spec/flipper/types/group_spec.rb
flipper-0.6.0 spec/flipper/types/group_spec.rb
flipper-0.5.0 spec/flipper/types/group_spec.rb
flipper-0.4.0 spec/flipper/types/group_spec.rb
flipper-0.3.0 spec/flipper/types/group_spec.rb
flipper-0.2.1 spec/flipper/types/group_spec.rb
flipper-0.2.0 spec/flipper/types/group_spec.rb
flipper-0.1.1 spec/flipper/types/group_spec.rb
flipper-0.1.0 spec/flipper/types/group_spec.rb