Sha256: a143c2e8c6158c9f763e987d909a5b127708c6da5d3b127f7925363944577169

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

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

describe ReHistoryController do
  extend RulesEngineMacros
  
  render_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

4 entries across 4 versions & 1 rubygems

Version Path
rules_engine-0.3.3 spec/controllers/re_history_controller_spec.rb
rules_engine-0.3.2 spec/controllers/re_history_controller_spec.rb
rules_engine-0.3.1 spec/controllers/re_history_controller_spec.rb
rules_engine-0.3.0 spec/controllers/re_history_controller_spec.rb