tab/spec/controllers/users_controller_spec.rb

37 lines
781 B
Ruby
Raw Normal View History

2015-09-12 13:03:04 +02:00
describe UsersController, type: :controller do
before :each do
@user = create :penning
sign_in @user
end
2015-09-08 15:14:46 +02:00
2015-09-12 13:03:04 +02:00
describe "GET show" do
before :each do
2019-04-10 16:14:02 +02:00
get :show, params: {id: @user}
2015-09-12 13:03:04 +02:00
end
2015-09-09 20:11:59 +02:00
2015-09-12 13:03:04 +02:00
it "should be successful" do
expect(response).to render_template(:show)
expect(response).to have_http_status(200)
end
it "should load the correct user" do
expect(assigns(:user)).to eq(@user)
end
end
describe "GET index" do
before :each do
get :index
end
it "should load an array of all users" do
expect(assigns(:users)).to eq([@user])
end
it "should render the correct template" do
expect(response).to have_http_status(200)
expect(response).to render_template(:index)
end
end
2015-09-08 15:14:46 +02:00
end