Sha256: 69251fec69a00a90bad4017f13338c2c0dcd90086a32c01f054f4981ee3b0e30
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'spec_helper' describe FreshConnection::AccessControl do before(:each) do @ac = FreshConnection::AccessControl end context ".access" do it "persisted first state(slave)" do ret = [] @ac.access(true) do @ac.access(true) do ret << @ac.slave_access? @ac.access(false) do ret << @ac.slave_access? end end end expect(ret).to be_all{|item| item} end it "persisted first state(master)" do ret = [] @ac.access(false) do @ac.access(true) do ret << @ac.slave_access? @ac.access(false) do ret << @ac.slave_access? end end end expect(ret).to_not be_all{|item| item} end it "outside is always master" do ret = [] ret << @ac.slave_access? @ac.access(true){} ret << @ac.slave_access? expect(ret).to_not be_all{|item| item} end end context ".force_master_access" do it "forced master state" do @ac.access(true) do @ac.force_master_access do expect(@ac.slave_access?).to be_false end end end it "not effect outside" do @ac.access(true) do @ac.force_master_access {} expect(@ac.slave_access?).to be_true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fresh_connection-0.2.1 | spec/unit/access_control_spec.rb |
fresh_connection-0.2.0 | spec/unit/access_control_spec.rb |