Sha256: da3d786f62d2bc26c55e0d686349be03a71270d7d05c8095e52236fa2bb12f0d

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

describe ReHistoryController do
  extend RulesEngineMacros
  
  integrate_views
  
  before(:each) do
    controller.instance_eval { flash.stub!(:sweep) }
    controller.stub!(:rules_engine_reader_access_required).and_return(true)
  end  

  describe "index" do
    it_should_require_rules_engine_reader_access(:index)
    
    it "should get the process runner history from the rules engine process runner" do
      runner = mock('runner')
      RulesEngine::Process.stub!(:runner).and_return(runner)
      
      re_history = {:history => "none"}
      runner.should_receive(:history).with(nil, anything()).and_return(re_history)
      get :index
      assigns[:re_history].should == re_history
    end
  end

  describe "show" do
    it_should_require_rules_engine_reader_access(:show, :id => 123)
    
    it "should get the audit history record with the process ID" do
      auditor = mock('auditor')
      RulesEngine::Process.stub!(:auditor).and_return(auditor)
      
      re_audit_history = {:history => "none"}
      auditor.should_receive(:history).with("123").and_return(re_audit_history)
      
      get :show, :id => 123
      assigns[:re_audit_history].should == re_audit_history
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rules_engine-0.2.0 rails_generators/templates/spec/controllers/re_history_controller_spec.rb