Sha256: 17d5a3c67cdec4538282d1afb56f9c45731742eea7fbb46a9b7f3680c9593e58

Contents?: true

Size: 741 Bytes

Versions: 10

Compression:

Stored size: 741 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.url)
    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

10 entries across 10 versions & 1 rubygems

Version Path
saucy-0.1.11 spec/controllers/application_controller_spec.rb
saucy-0.1.9 spec/controllers/application_controller_spec.rb
saucy-0.1.8 spec/controllers/application_controller_spec.rb
saucy-0.1.7 spec/controllers/application_controller_spec.rb
saucy-0.1.6 spec/controllers/application_controller_spec.rb
saucy-0.1.5 spec/controllers/application_controller_spec.rb
saucy-0.1.4 spec/controllers/application_controller_spec.rb
saucy-0.1.3 spec/controllers/application_controller_spec.rb
saucy-0.1.2 spec/controllers/application_controller_spec.rb
saucy-0.1.1 spec/controllers/application_controller_spec.rb