Sha256: b1fd12003a9a96eb7f8208c16dcd550068b2bcdb47b14fecdcf4b2a0e1e2d599

Contents?: true

Size: 1.27 KB

Versions: 4

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Flms::UsersController do
  include NamedFactories

  describe 'index' do
    describe 'access control' do
      let(:request) { get :index, use_route: :flms }
      it_should_behave_like 'an action accessible only to logged-in users'
    end
  end

  describe 'new' do
    describe 'access control' do
      let(:request) { get :new, use_route: :flms }
      it_should_behave_like 'an action accessible only to logged-in users'
    end
  end

  describe 'create' do
    describe 'access control' do
      let(:request) { post :create, user: attributes_for(:user), use_route: :flms }
      let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/users' }
      let(:database_performed_check) { Flms::User.count == 2 }
      it_should_behave_like 'an action accessible only to logged-in users'
    end
  end

  describe 'delete' do
    describe 'access control' do
      let(:request) { delete :destroy, id: user_2.id, use_route: :flms }
      let(:access_granted_check) { response.status == 302 && response.location == 'http://test.host/flms/users' }
      let(:database_performed_check) { Flms::User.find_by_id(user_2.id) == nil }
      it_should_behave_like 'an action accessible only to logged-in users'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flms-0.9.0 spec/controllers/users_controller_spec.rb
flms-0.1.0 spec/controllers/users_controller_spec.rb
flms-0.0.3 spec/controllers/users_controller_spec.rb
flms-0.0.2 spec/controllers/users_controller_spec.rb