Skip to content

Commit

Permalink
Merge pull request #61 from zenith19/49297_rspec_trainee_user_control…
Browse files Browse the repository at this point in the history
…ler_index

49297_rspec_trainee_user_controller_index
  • Loading branch information
dieunb committed Dec 24, 2015
2 parents 56fff01 + d3fad22 commit 51e9bd9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require "rails_helper"

describe UsersController do
let(:user){FactoryGirl.create :user}
before{sign_in user}

describe "GET index" do
before {get :index}
context "Get index successfully" do
it {expect(response).to be_success}
it {expect(response).to have_http_status :ok}
it {expect(response).to render_template :index}
end
it "populates list of users" do
expect(assigns(:users)).to include user
end
end
end
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

config.include Devise::TestHelpers, type: :controller
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
Expand Down

0 comments on commit 51e9bd9

Please sign in to comment.