Commit 12c77c19 authored by marcheing's avatar marcheing

Fix indentation on profiles controller spec

parent 7e0de97d
......@@ -53,31 +53,31 @@ RSpec.describe ProfilesController, type: :controller do
describe "GET #index" do
it "assigns all profiles as @profiles" do
profile = Profile.create! valid_attributes
get :index, params: {}, session: valid_session
expect(assigns(:profiles)).to eq([profile])
get :index, params: {}, session: valid_session
expect(assigns(:profiles)).to eq([profile])
end
end
describe "GET #show" do
it "assigns the requested profile as @profile" do
profile = Profile.create! valid_attributes
get :show, params: {id: profile.to_param}, session: valid_session
expect(assigns(:profile)).to eq(profile)
get :show, params: {id: profile.to_param}, session: valid_session
expect(assigns(:profile)).to eq(profile)
end
end
describe "GET #new" do
it "assigns a new profile as @profile" do
get :new, params: {}, session: valid_session
expect(assigns(:profile)).to be_a_new(Profile)
get :new, params: {}, session: valid_session
expect(assigns(:profile)).to be_a_new(Profile)
end
end
describe "GET #edit" do
it "assigns the requested profile as @profile" do
profile = Profile.create! valid_attributes
get :edit, params: {id: profile.to_param}, session: valid_session
expect(assigns(:profile)).to eq(profile)
get :edit, params: {id: profile.to_param}, session: valid_session
expect(assigns(:profile)).to eq(profile)
end
end
......@@ -85,31 +85,31 @@ RSpec.describe ProfilesController, type: :controller do
context "with valid params" do
it "creates a new Profile" do
expect {
post :create, params: { profile: valid_request_parameters }, session: valid_session
}.to change(Profile, :count).by(1)
post :create, params: { profile: valid_request_parameters }, session: valid_session
}.to change(Profile, :count).by(1)
end
it "assigns a newly created profile as @profile" do
post :create, params: { profile: valid_request_parameters }, session: valid_session
expect(assigns(:profile)).to be_a(Profile)
post :create, params: { profile: valid_request_parameters }, session: valid_session
expect(assigns(:profile)).to be_a(Profile)
expect(assigns(:profile)).to be_persisted
end
it "redirects to the created profile" do
post :create, params: { profile: valid_request_parameters }, session: valid_session
expect(response).to redirect_to(Profile.last)
post :create, params: { profile: valid_request_parameters }, session: valid_session
expect(response).to redirect_to(Profile.last)
end
end
context "with invalid params" do
it "assigns a newly created but unsaved profile as @profile" do
post :create, params: {profile: invalid_attributes}, session: valid_session
expect(assigns(:profile)).to be_a_new(Profile)
post :create, params: {profile: invalid_attributes}, session: valid_session
expect(assigns(:profile)).to be_a_new(Profile)
end
it "re-renders the 'new' template" do
post :create, params: {profile: invalid_attributes}, session: valid_session
expect(response).to render_template("new")
post :create, params: {profile: invalid_attributes}, session: valid_session
expect(response).to render_template("new")
end
end
end
......@@ -122,35 +122,35 @@ RSpec.describe ProfilesController, type: :controller do
it "updates the requested profile" do
profile = Profile.create! valid_attributes
put :update, params: {id: profile.to_param, profile: new_attributes}, session: valid_session
profile.reload
put :update, params: {id: profile.to_param, profile: new_attributes}, session: valid_session
profile.reload
skip("Add assertions for updated state")
end
it "assigns the requested profile as @profile" do
profile = Profile.create! valid_attributes
put :update, params: { id: profile.to_param, profile: valid_request_parameters }, session: valid_session
expect(assigns(:profile)).to eq(profile)
put :update, params: { id: profile.to_param, profile: valid_request_parameters }, session: valid_session
expect(assigns(:profile)).to eq(profile)
end
it "redirects to the profile" do
profile = Profile.create! valid_attributes
put :update, params: {id: profile.to_param, profile: valid_request_parameters }, session: valid_session
expect(response).to redirect_to(profile)
put :update, params: {id: profile.to_param, profile: valid_request_parameters }, session: valid_session
expect(response).to redirect_to(profile)
end
end
context "with invalid params" do
it "assigns the profile as @profile" do
profile = Profile.create! valid_attributes
put :update, params: {id: profile.to_param, profile: invalid_attributes}, session: valid_session
expect(assigns(:profile)).to eq(profile)
put :update, params: {id: profile.to_param, profile: invalid_attributes}, session: valid_session
expect(assigns(:profile)).to eq(profile)
end
it "re-renders the 'edit' template" do
profile = Profile.create! valid_attributes
put :update, params: {id: profile.to_param, profile: invalid_attributes}, session: valid_session
expect(response).to render_template("edit")
put :update, params: {id: profile.to_param, profile: invalid_attributes}, session: valid_session
expect(response).to render_template("edit")
end
end
end
......@@ -159,14 +159,14 @@ RSpec.describe ProfilesController, type: :controller do
it "destroys the requested profile" do
profile = Profile.create! valid_attributes
expect {
delete :destroy, params: {id: profile.to_param}, session: valid_session
}.to change(Profile, :count).by(-1)
delete :destroy, params: {id: profile.to_param}, session: valid_session
}.to change(Profile, :count).by(-1)
end
it "redirects to the profiles list" do
profile = Profile.create! valid_attributes
delete :destroy, params: {id: profile.to_param}, session: valid_session
expect(response).to redirect_to(profiles_url)
delete :destroy, params: {id: profile.to_param}, session: valid_session
expect(response).to redirect_to(profiles_url)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment