Sha256: 179a08fbba6becfc515e5a4a746744c69fa1e23b604245df6b0f3a920eebd4ed
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
require 'helper' describe Flipper do describe ".new" do it "returns new instance of dsl" do instance = Flipper.new(double('Adapter')) instance.should be_instance_of(Flipper::DSL) end end describe ".groups" do it "returns a registry instance" do Flipper.groups.should be_instance_of(Flipper::Registry) end end describe ".groups=" do it "sets groups registry" do registry = Flipper::Registry.new Flipper.groups = registry Flipper.instance_variable_get("@groups").should eq(registry) end end describe ".register" do it "adds a group to the group_registry" do registry = Flipper::Registry.new Flipper.groups = registry group = Flipper.register(:admins) { |actor| actor.admin? } registry.get(:admins).should eq(group) end it "raises exception if group already registered" do Flipper.register(:admins) { } expect { Flipper.register(:admins) { } }.to raise_error(Flipper::DuplicateGroup) end end describe ".group" do context "for registered group" do before do @group = Flipper.register(:admins) { } end it "returns group" do Flipper.group(:admins).should eq(@group) end end context "for unregistered group" do it "returns nil" do Flipper.group(:cats).should be_nil end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
flipper-0.3.0 | spec/flipper_spec.rb |
flipper-0.2.1 | spec/flipper_spec.rb |
flipper-0.2.0 | spec/flipper_spec.rb |
flipper-0.1.1 | spec/flipper_spec.rb |
flipper-0.1.0 | spec/flipper_spec.rb |