Sha256: 0e46fc63b805ef5136f3b2ce0f6d8a8efc7624ec734e21ba3742d5130c4b4548

Contents?: true

Size: 839 Bytes

Versions: 19

Compression:

Stored size: 839 Bytes

Contents

require 'spec_helper'

describe DashboardsController, :type => :controller do

  it "should not raise an error if the checked power is given" do
    expect { get :show }.to_not raise_error
  end

  it 'should define a method #current_power that returns the Power' do
    controller.should_receive(:observe).with(kind_of(Power))
    get :show
  end

  it "should set the current power before the request, and nilify it after the request" do
    controller.send(:current_power).should be_nil
    Power.should_receive_and_execute(:current=).ordered.with(kind_of(Power))
    Power.should_receive_and_execute(:current=).ordered.with(nil)
    get :show
  end

  it 'should nilify the current power even if the action raises an error' do
    expect { post :error }.to raise_error(/error during action/)
    Power.current.should be_nil
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
consul-0.12.2 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.12.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.12.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.11.2 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.11.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.11.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.10.2 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.10.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.10.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.9.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.9.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.8.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.7.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.6.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.6.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.5.0 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.4.2 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.4.1 spec/shared/consul/controllers/dashboards_controller_spec.rb
consul-0.4.0 spec/shared/controllers/dashboards_controller_spec.rb