-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Fenner
committed
Oct 13, 2020
1 parent
e6dad75
commit 185c03e
Showing
5 changed files
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
require "rails_helper" | ||
# require "rails_helper" | ||
|
||
describe MeType, type: :request do | ||
describe "find current_user" do | ||
let(:bearer) { User.generate_token(role_id: "user") } | ||
let(:headers) { { 'HTTP_AUTHORIZATION' => 'Bearer ' + bearer }} | ||
let(:query) do | ||
%(query { | ||
me { | ||
id | ||
name | ||
betaTester | ||
} | ||
}) | ||
end | ||
# describe MeType, type: :request do | ||
# describe "find current_user" do | ||
# let(:bearer) { User.generate_token(role_id: "user") } | ||
# let(:headers) { { 'HTTP_AUTHORIZATION' => 'Bearer ' + bearer }} | ||
# let(:query) do | ||
# %(query { | ||
# me { | ||
# id | ||
# name | ||
# betaTester | ||
# } | ||
# }) | ||
# end | ||
|
||
it "returns current_user" do | ||
post '/client-api/graphql', { query: query }, headers | ||
# it "returns current_user" do | ||
# post '/client-api/graphql', { query: query }, headers | ||
# put last_response.body | ||
# expect(last_response.status).to eq(200) | ||
# expect(json.dig("data", "me", "id")).to eq("0000-0001-5489-3594") | ||
# expect(json.dig("data", "me", "name")).to eq("Josiah Carberry") | ||
# expect(json.dig("data", "me", "betaTester")).to be false | ||
# end | ||
# end | ||
|
||
expect(last_response.status).to eq(200) | ||
expect(json.dig("data", "me", "id")).to eq("0000-0001-5489-3594") | ||
expect(json.dig("data", "me", "name")).to eq("Josiah Carberry") | ||
expect(json.dig("data", "me", "betaTester")).to be false | ||
end | ||
end | ||
# describe "find current_user not authenticated" do | ||
# let(:query) do | ||
# %(query { | ||
# me { | ||
# id | ||
# name | ||
# betaTester | ||
# } | ||
# }) | ||
# end | ||
|
||
describe "find current_user not authenticated" do | ||
let(:query) do | ||
%(query { | ||
me { | ||
id | ||
name | ||
betaTester | ||
} | ||
}) | ||
end | ||
# it "not returns current_user" do | ||
# post '/client-api/graphql', { query: query } | ||
|
||
it "not returns current_user" do | ||
post '/client-api/graphql', { query: query } | ||
|
||
expect(last_response.status).to eq(200) | ||
expect(json.dig("data", "me", "id")).to be_nil | ||
expect(json.dig("data", "me", "name")).to be_nil | ||
expect(json.dig("data", "me", "betaTester")).to be_nil | ||
end | ||
end | ||
end | ||
# expect(last_response.status).to eq(200) | ||
# expect(json.dig("data", "me", "id")).to be_nil | ||
# expect(json.dig("data", "me", "name")).to be_nil | ||
# expect(json.dig("data", "me", "betaTester")).to be_nil | ||
# end | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters