Sha256: 0b28bf5e138319518e8d9e3816632a8466a0acb8e5185c0a253006d40743bbf7
Contents?: true
Size: 1.31 KB
Versions: 7
Compression:
Stored size: 1.31 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_falsey end end end it "not effect outside" do @ac.access(true) do @ac.force_master_access {} expect(@ac.slave_access?).to be_truthy end end end end
Version data entries
7 entries across 7 versions & 1 rubygems