Sha256: 081b5b0874ffd071cc4961f47badd2cec0a1d6678030d14f2eaa641d2f69e633
Contents?: true
Size: 723 Bytes
Versions: 7
Compression:
Stored size: 723 Bytes
Contents
require "spec_helper" describe ErpRules::RulesEngine::Ruleby::Engine do before(:each) do RuleBook = Class.new(Ruleby::Rulebook) do def rules rule :last_name_is_smith, {:priority => 1},[ErpRules::RulesEngine::Context, :context, m.customer_last_name == 'Smith'] do |v| v[:context].valid_offers << 2 end end end @rule_context = ErpRules::RulesEngine::Context.new end it "should invoke ruleby and execute context against a rulebook" do @rule_context[:customer_last_name] = "Smith" @rule_context[:valid_offers] = [] @context = ErpRules::RulesEngine::Ruleby::Engine.invoke(RuleBook, @rule_context) @context[:valid_offers].should include(2) end end
Version data entries
7 entries across 7 versions & 1 rubygems