Sha256: 4b41e4293367ea5f56a40a6da0939e62b07c59e1f4b90de2dcb788eb93592642

Contents?: true

Size: 922 Bytes

Versions: 12

Compression:

Stored size: 922 Bytes

Contents

require 'spec_helper'

describe Krikri::ProvidersController, :type => :controller do

  routes { Krikri::Engine.routes }

  describe 'GET #show' do
    login_user

    it 'sets provider variable' do
      expect { get :show, id: 'moomin' }
        .to change { assigns[:current_provider] }
             .to an_instance_of(Krikri::Provider)
    end

    it 'renders the :show view' do
      get :show, id: 'moomin'
      expect(response).to render_template('krikri/providers/show')
    end
  end

  describe 'GET #index' do
    login_user

    it 'renders the :show view' do
      get :index
      expect(response).to render_template('krikri/providers/index')
    end

    it 'sets providers variable' do
      providers = [instance_double(Krikri::Provider)]
      allow(Krikri::Provider).to receive(:all).and_return(providers)

      expect { get :index }.to change { assigns[:providers] }.to(providers)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
krikri-0.7.2 spec/controllers/providers_controller_spec.rb
krikri-0.7.1 spec/controllers/providers_controller_spec.rb
krikri-0.7.0 spec/controllers/providers_controller_spec.rb
krikri-0.6.0 spec/controllers/providers_controller_spec.rb
krikri-0.5.7 spec/controllers/providers_controller_spec.rb
krikri-0.5.6 spec/controllers/providers_controller_spec.rb
krikri-0.5.5 spec/controllers/providers_controller_spec.rb
krikri-0.5.4 spec/controllers/providers_controller_spec.rb
krikri-0.5.3 spec/controllers/providers_controller_spec.rb
krikri-0.5.2 spec/controllers/providers_controller_spec.rb
krikri-0.5.1 spec/controllers/providers_controller_spec.rb
krikri-0.5.0 spec/controllers/providers_controller_spec.rb