Sha256: 9a0561d57f548a88d491c98435951f65c858b08327d6363d11c5667c05e55488

Contents?: true

Size: 1023 Bytes

Versions: 1

Compression:

Stored size: 1023 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe ReRuleExpectedOutcome do
  def valid_attributes
    {
      :outcome => RulesEngine::RuleOutcome::OUTCOME_NEXT
    }
  end
  
  it "should be valid with valid attributes" do
    ReRuleExpectedOutcome.new(valid_attributes).should be_valid
  end
  
  should_validate_presence_of :outcome

  describe "START WORKFLOW" do
    it "should be invalid when the outcome workflow code is blank" do
      re_rule_expected_outcome = ReRuleExpectedOutcome.new(:outcome => RulesEngine::RuleOutcome::OUTCOME_START_WORKFLOW)
      re_rule_expected_outcome.should_not be_valid
      re_rule_expected_outcome.errors.on(:workflow_code).should_not be_blank
    end      
  
    it "should be valid when outcome workflow code is present" do
      re_rule_expected_outcome = ReRuleExpectedOutcome.new(:outcome => RulesEngine::RuleOutcome::OUTCOME_START_WORKFLOW, :workflow_code => "mock code")
      re_rule_expected_outcome.should be_valid
    end      
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rules_engine-0.1.3 rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb