Sha256: 25412b00d62c3961b894686e3f4c4ab870d324049e2f0f2d762a1984030703ff
Contents?: true
Size: 1.24 KB
Versions: 8
Compression:
Stored size: 1.24 KB
Contents
require 'helper' require 'flipper/types/group' describe Flipper::Types::Group do subject do Flipper.register(:admins) { |actor| actor.admin? } end describe ".wrap" do context "with group instance" do it "returns group instance" do described_class.wrap(subject).should eq(subject) end end context "with Symbol group name" do it "returns group instance" do described_class.wrap(subject.name).should eq(subject) end end context "with String group name" do it "returns group instance" do described_class.wrap(subject.name.to_s).should eq(subject) end end 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 eq(true) end it "returns false if block does not match" do subject.match?(non_admin_actor).should eq(false) end end end
Version data entries
8 entries across 8 versions & 1 rubygems