Sha256: 2a8d2fc23613349ee30dfd9b18737da9cc483621231ee023e4c1e10edb65c0fa
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe Credentials::AllowRule do it "should have the correct arity" do Credentials::AllowRule.new(Animal, :jump).arity.should == 2 end it "should match the simple case" do antelope = Prey.new("antelope") Credentials::AllowRule.new(Animal, :jump).allow?(antelope, :jump).should == true end it "should match the subject, verb, object case" do antelope = Prey.new("antelope") lion = Carnivore.new("lion") Credentials::AllowRule.new(Carnivore, :eat, Prey).allow?(lion, :eat, antelope).should == true end it "should throw an error when it gets bad arguments" do lambda { lion = Carnivore.new("lion") rule = Credentials::AllowRule.new(Animal, :jump, :if => Date.civil(2010, 4, 1)) rule.match?(lion, :jump) }.should raise_error(ArgumentError) end end describe Credentials::DenyRule do it "should have the correct arity" do Credentials::DenyRule.new(Animal, :jump).arity.should == 2 end it "should match the simple case" do elephant = Prey.new("elephant") Credentials::DenyRule.new(Animal, :jump).deny?(elephant, :jump).should == true end it "should match the subject, verb, object case" do antelope = Prey.new("antelope") lion = Carnivore.new("lion") Credentials::DenyRule.new(Carnivore, :eat, Prey).deny?(lion, :eat, antelope).should == true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
credentials-2.0.0 | spec/rule_spec.rb |