Sha256: 8192f5132848fd1cc8f6c30d25eb930482322a0cdcaf5a97510e35c3ee810df3

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe Dashing::WidgetsController do

  describe 'GET "show"' do

    def action(params = {})
      get :show, params.merge(use_route: :dashing)
    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.merge(use_route: :dashing)
    end

    context 'when valid' do

      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

10 entries across 10 versions & 1 rubygems

Version Path
dashing-rails-2.2.0 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-2.1.1 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-2.1.0 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-2.0.2 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-2.0.1 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-2.0.0 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-1.0.3 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-1.0.2 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-1.0.1 spec/controllers/dashing/widgets_controller_spec.rb
dashing-rails-1.0.0 spec/controllers/dashing/widgets_controller_spec.rb