Sha256: 885461b91dce5818dde3a24ca2f14552fd61da9fb910f176d268834a11174e0e

Contents?: true

Size: 923 Bytes

Versions: 3

Compression:

Stored size: 923 Bytes

Contents

require 'spec_helper'

describe MembershipsController, "routes" do
  it { should route(:get, "/accounts/abc/memberships").
                to(:action => :index, :account_id => 'abc') }
end

describe MembershipsController, "permissions", :as => :account_member do
  it { should deny_access.
                on(:get, :index, :account_id => account.to_param).
                flash(/admin/) }
end

describe MembershipsController, "index", :as => :account_admin do
  let(:users) { [Factory.stub(:user), Factory.stub(:user)] }

  before do
    Account.stubs(:find_by_url! => account)
    account.stubs(:users_by_name => users)
    get :index, :account_id => account.to_param
  end

  it "renders the index template" do
    should respond_with(:success)
    should render_template(:index)
  end

  it "assigns users by name" do
    account.should have_received(:users_by_name)
    should assign_to(:users).with(users)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
saucy-0.1.3 spec/controllers/memberships_controller_spec.rb
saucy-0.1.2 spec/controllers/memberships_controller_spec.rb
saucy-0.1.1 spec/controllers/memberships_controller_spec.rb