Sha256: 17acc859083f3470741bba9550a7c9b055a7806b1dbdaf3403677ee21a143a1f

Contents?: true

Size: 1005 Bytes

Versions: 3

Compression:

Stored size: 1005 Bytes

Contents

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

describe ReRuleExpectedOutcome do
  def valid_attributes
    {
      :outcome => RulesEngine::Rule::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::Rule::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::Rule::Outcome::START_WORKFLOW, :workflow_code => "mock code")
      re_rule_expected_outcome.should be_valid
    end      
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rules_engine-0.1.6 rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb
rules_engine-0.1.5 rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb
rules_engine-0.1.4 rails_generators/templates/spec/models/re_rule_expected_outcome_spec.rb