root/spec/support/mocks/permit_access.rb

Download in other formats: Raw | Text
Revisions
Dimitrij Denissenko
Dimitrij Denissenko
Jul 04 2009 * 14:42
(about 1 year ago)

Revision b9bfdf92e4c21917d4470940c9276b9746ae380b

Upgraded to rspec 1.2.7

1
2
3
4
5
6
7
8
9
10
11
12
13
ActionController::TestCase.class_eval do
  def permit_access!
    @controller.class.stub!(:authorize?).and_return(true)
    @retro_cm_configuration = mock_model(RetroCM::Configuration, :section_hash => {}, :updated_at => Time.now, :apply => true)
    RetroCM::Configuration.stub!(:find_or_create).and_return(@retro_cm_configuration)
  end

  def permit_access_with_current_project!(methods = {})
    permit_access!
    @controller.stub!(:find_project).and_return(true)
    mock_current_project! methods
  end
end