Sha256: ca07a788f4126fad3ceea40e56f64247377a747a600ba679971bd640b0af7bc1

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

require 'spec_helper'

module FinePrint
  describe HomeController, :type => :controller do
    routes { FinePrint::Engine.routes }

    before(:each) do
      setup_controller_spec
    end

    it "won't get index unless authorized" do
      expect { get :index, :use_route => :fine_print }
             .to raise_error(ActionController::RoutingError)
      
      sign_in @user
      expect { get :index, :use_route => :fine_print }
             .to raise_error(ActionController::RoutingError)
    end
    
    it 'must get index if authorized' do
      sign_in @user
      @user.is_admin = true
      get :index, :use_route => :fine_print
      expect(response).to redirect_to contracts_path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fine_print-2.0.1 spec/controllers/home_controller_spec.rb
fine_print-2.0.0 spec/controllers/home_controller_spec.rb