Sha256: 5412dcaded3e68b4c37b50b993f11b973ab41af044c7607bbdfee47862eb2392

Contents?: true

Size: 1.15 KB

Versions: 23

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe MyDashboard::WidgetsController do

  let(:redis) { double }

  before do
    stub_redis(redis)
    @routes = MyDashboard::Engine.routes
  end

  describe 'GET "show"' do

    def action(params = {})
      get :show, params
    end

    context 'when default template exists' do

      it 'responds success' do
        action(name: 'text')
        expect(response).to be_success
      end

    end

    context 'when template exists in main app' do

      it 'responds success' do
        action(name: 'foo')
        expect(response).to be_success
      end

    end

    context 'when template does not exist' do

      it { expect { action }.to raise_error }
      it { expect { action(name: 'bar') }.to raise_error }

    end

  end

  describe 'PUT "update"' do

    def action(params = {})
      put :update, params
    end

    context 'when valid' do

      before do
        expect(redis).to receive(:publish)
      end

      it 'responds success' do
        action(name: 'foo')
        expect(response).to be_success
      end

    end

    context 'when not valid' do

      it { expect { action }.to raise_error }

    end

  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
my_dashboard-0.8.6 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.8.5 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.8.4 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.8.3 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.8.1 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.8.0 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.7.2 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.7.1 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.7.0 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.6.0 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.10 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.9 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.8 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.7 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.6 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.5 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.4 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.3 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.2 spec/controllers/my_dashboard/widgets_controller_spec.rb
my_dashboard-0.5.1 spec/controllers/my_dashboard/widgets_controller_spec.rb