Commit b4b02485 authored by Timothy Andrew's avatar Timothy Andrew

Parts of spec names with "when" should be contexts.

parent a1295d8e
...@@ -41,18 +41,23 @@ describe ApplicationController do ...@@ -41,18 +41,23 @@ describe ApplicationController do
let(:user) { create(:user) } let(:user) { create(:user) }
it "logs the user in when the 'private_token' param is populated with the private token" do context "when the 'private_token' param is populated with the private token" do
it "logs the user in" do
get :index, private_token: user.private_token get :index, private_token: user.private_token
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.body).to eq("authenticated") expect(response.body).to eq("authenticated")
end end
end
it "logs the user in when the 'PRIVATE-TOKEN' header is populated with the private token" do context "when the 'PRIVATE-TOKEN' header is populated with the private token" do
it "logs the user in" do
@request.headers['PRIVATE-TOKEN'] = user.private_token @request.headers['PRIVATE-TOKEN'] = user.private_token
get :index get :index
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.body).to eq("authenticated") expect(response.body).to eq("authenticated")
end end
end
it "doesn't log the user in otherwise" do it "doesn't log the user in otherwise" do
@request.headers['PRIVATE-TOKEN'] = "token" @request.headers['PRIVATE-TOKEN'] = "token"
...@@ -72,18 +77,22 @@ describe ApplicationController do ...@@ -72,18 +77,22 @@ describe ApplicationController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:personal_access_token) { create(:personal_access_token, user: user) } let(:personal_access_token) { create(:personal_access_token, user: user) }
it "logs the user in when the 'personal_access_token' param is populated with the personal access token" do context "when the 'personal_access_token' param is populated with the personal access token" do
it "logs the user in" do
get :index, private_token: personal_access_token.token get :index, private_token: personal_access_token.token
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.body).to eq('authenticated') expect(response.body).to eq('authenticated')
end end
end
it "logs the user in when the 'PERSONAL_ACCESS_TOKEN' header is populated with the personal access token" do context "when the 'PERSONAL_ACCESS_TOKEN' header is populated with the personal access token" do
it "logs the user in" do
@request.headers["PRIVATE-TOKEN"] = personal_access_token.token @request.headers["PRIVATE-TOKEN"] = personal_access_token.token
get :index get :index
expect(response.status).to eq(200) expect(response.status).to eq(200)
expect(response.body).to eq('authenticated') expect(response.body).to eq('authenticated')
end end
end
it "doesn't log the user in otherwise" do it "doesn't log the user in otherwise" do
get :index, private_token: "token" get :index, private_token: "token"
......
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