Sha256: 97a21e1f6f70c379f983fd29d7647929dff67b1d7fdf706ea1fab107ee8635c7

Contents?: true

Size: 746 Bytes

Versions: 22

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

describe ApplicationController do

  describe "with a valid account id in the params" do
    before do
      @account = Factory(:account)
      @controller.stubs(:params).returns(:account_id => @account.to_param)
    end

    it "should return the corresponding account from current_account" do
      @controller.__send__(:current_account).should == @account
    end
  end

  describe "with an invalid account id in the params" do
    before do
      @controller.stubs(:params).returns(:account_id => "invalid")
    end

    it "should return the corresponding account from current_account" do
      expect { @controller.__send__(:current_account) }.
        to raise_error(ActiveRecord::RecordNotFound)
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
saucy-0.2.11 spec/controllers/application_controller_spec.rb
saucy-0.2.10 spec/controllers/application_controller_spec.rb
saucy-0.2.9 spec/controllers/application_controller_spec.rb
saucy-0.2.8.1 spec/controllers/application_controller_spec.rb
saucy-0.2.8 spec/controllers/application_controller_spec.rb
saucy-0.2.7 spec/controllers/application_controller_spec.rb
saucy-0.2.6.1 spec/controllers/application_controller_spec.rb
saucy-0.2.6 spec/controllers/application_controller_spec.rb
saucy-0.2.5 spec/controllers/application_controller_spec.rb
saucy-0.2.4.1 spec/controllers/application_controller_spec.rb
saucy-0.2.4 spec/controllers/application_controller_spec.rb
saucy-0.2.3 spec/controllers/application_controller_spec.rb
saucy-0.2.2 spec/controllers/application_controller_spec.rb
saucy-0.2.1 spec/controllers/application_controller_spec.rb
saucy-0.2.0 spec/controllers/application_controller_spec.rb
saucy-0.1.18 spec/controllers/application_controller_spec.rb
saucy-0.1.17 spec/controllers/application_controller_spec.rb
saucy-0.1.16 spec/controllers/application_controller_spec.rb
saucy-0.1.15 spec/controllers/application_controller_spec.rb
saucy-0.1.14 spec/controllers/application_controller_spec.rb