Sha256: dc66c132b343e30064fffa02f1087ca6e4dc21fc8b1f30c43f2f75eb676cd4d9
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe Rulebook do let(:rulebook) { Rulebook.new } let(:regexp) { /^foobar$/ } describe "#initialize" do it "should have the #rules method available" do rulebook.should be_instance_of(Rulebook) rulebook.should respond_to(:rules) rulebook.rules.should == Array.new end end describe "#add and #<<" do it "should add a rule correctly" do block = proc { puts "Foobar" } Rulebook::Rule.expects(:initialize).with(regexp, block) rulebook.rules.length.should == 0 rulebook.add(regexp, &block) rulebook.rules.length.should == 1 end end describe "#[], #match, and #rules_that_match_against" do it "should return an Array of rules that match the given query" do query = "foobar" rulebook.add(regexp) { "Foobar" } rulebook[query].should == [rulebook.rules.first] rulebook.match(query).should == [rulebook.rules.first] rulebook.rules_that_match_against(query).should == [rulebook.rules.first] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rulebook-0.5.0 | spec/rulebook_spec.rb |