Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2017-06-23 14:18:44 +0300
committerTimothy Andrew <mail@timothyandrew.net>2017-06-28 10:17:13 +0300
commit4dbfa14e160e0d9bca11941adcf04b3d272aa1a2 (patch)
tree9affe145ebecd6e57ced495fa18d29d2a406d37a /spec/services/access_token_validation_service_spec.rb
parent1b8223dd51345f6075172a92dab610f9dee89d84 (diff)
Implement review comments from @dbalexandre for !12300.
Diffstat (limited to 'spec/services/access_token_validation_service_spec.rb')
-rw-r--r--spec/services/access_token_validation_service_spec.rb24
1 files changed, 11 insertions, 13 deletions
diff --git a/spec/services/access_token_validation_service_spec.rb b/spec/services/access_token_validation_service_spec.rb
index eff4269a4d5..c8189aa14d8 100644
--- a/spec/services/access_token_validation_service_spec.rb
+++ b/spec/services/access_token_validation_service_spec.rb
@@ -41,24 +41,22 @@ describe AccessTokenValidationService, services: true do
end
context "conditions" do
- context "if" do
- it "ignores any scopes whose `if` condition returns false" do
- token = double("token", scopes: [:api, :read_user])
+ it "ignores any scopes whose `if` condition returns false" do
+ token = double("token", scopes: [:api, :read_user])
- expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { false } }])).to be(false)
- end
+ expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { false } }])).to be(false)
+ end
- it "does not ignore scopes whose `if` condition is not set" do
- token = double("token", scopes: [:api, :read_user])
+ it "does not ignore scopes whose `if` condition is not set" do
+ token = double("token", scopes: [:api, :read_user])
- expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { false } }, { name: :read_user }])).to be(true)
- end
+ expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { false } }, { name: :read_user }])).to be(true)
+ end
- it "does not ignore scopes whose `if` condition returns true" do
- token = double("token", scopes: [:api, :read_user])
+ it "does not ignore scopes whose `if` condition returns true" do
+ token = double("token", scopes: [:api, :read_user])
- expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { true } }, { name: :read_user, if: ->(_) { false } }])).to be(true)
- end
+ expect(described_class.new(token, request: request).include_any_scope?([{ name: :api, if: ->(_) { true } }, { name: :read_user, if: ->(_) { false } }])).to be(true)
end
end
end