Sha256: 949d52602e1ec08fe839fbe412a33e6d143cf20909d3021f9ffe2539fa60cea8

Contents?: true

Size: 517 Bytes

Versions: 2

Compression:

Stored size: 517 Bytes

Contents

require 'enabler'

describe Enabler::Rule do
  let(:model) { double('Model', id:1) }
  let(:pass_rule_def) { Proc.new { |model| model.id == 1 } }
  let(:fail_rule_def) { Proc.new { |model| model.id != 1} }

  context "with a passing rule" do
    subject { Enabler::Rule.new(:jump, pass_rule_def) }
    specify { subject.enabled?(model).should be_true }
  end

  context "with a failing rule" do
    subject { Enabler::Rule.new(:jump, fail_rule_def) }
    specify { subject.enabled?(model).should be_false }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enabler-0.0.5 spec/enabler/rule_spec.rb
enabler-0.0.4 spec/enabler/rule_spec.rb