privy_wine_bouncer 1.0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +23 -0
  5. data/.rubocop_todo.yml +182 -0
  6. data/.travis.yml +124 -0
  7. data/CHANGELOG.md +60 -0
  8. data/CONTRIBUTING.md +55 -0
  9. data/Gemfile +21 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +238 -0
  12. data/Rakefile +11 -0
  13. data/UPGRADING.md +62 -0
  14. data/lib/generators/templates/wine_bouncer.rb +9 -0
  15. data/lib/generators/wine_bouncer/initializer_generator.rb +14 -0
  16. data/lib/privy_wine_bouncer.rb +3 -0
  17. data/lib/wine_bouncer/auth_methods/auth_methods.rb +38 -0
  18. data/lib/wine_bouncer/auth_strategies/default.rb +27 -0
  19. data/lib/wine_bouncer/auth_strategies/protected.rb +43 -0
  20. data/lib/wine_bouncer/auth_strategies/swagger.rb +33 -0
  21. data/lib/wine_bouncer/base_strategy.rb +7 -0
  22. data/lib/wine_bouncer/configuration.rb +70 -0
  23. data/lib/wine_bouncer/errors.rb +23 -0
  24. data/lib/wine_bouncer/extension.rb +24 -0
  25. data/lib/wine_bouncer/oauth2.rb +106 -0
  26. data/lib/wine_bouncer/version.rb +5 -0
  27. data/lib/wine_bouncer.rb +14 -0
  28. data/spec/dummy/README.rdoc +28 -0
  29. data/spec/dummy/Rakefile +6 -0
  30. data/spec/dummy/app/api/default_api.rb +71 -0
  31. data/spec/dummy/app/api/protected_api.rb +66 -0
  32. data/spec/dummy/app/api/swagger_api.rb +61 -0
  33. data/spec/dummy/app/assets/config/manifest.js +1 -0
  34. data/spec/dummy/app/assets/images/.keep +0 -0
  35. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  36. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +7 -0
  38. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  39. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  40. data/spec/dummy/app/mailers/.keep +0 -0
  41. data/spec/dummy/app/models/.keep +0 -0
  42. data/spec/dummy/app/models/concerns/.keep +0 -0
  43. data/spec/dummy/app/models/user.rb +4 -0
  44. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  45. data/spec/dummy/bin/bundle +3 -0
  46. data/spec/dummy/bin/rails +4 -0
  47. data/spec/dummy/bin/rake +4 -0
  48. data/spec/dummy/config/application.rb +31 -0
  49. data/spec/dummy/config/boot.rb +7 -0
  50. data/spec/dummy/config/database.yml +25 -0
  51. data/spec/dummy/config/environment.rb +7 -0
  52. data/spec/dummy/config/environments/development.rb +39 -0
  53. data/spec/dummy/config/environments/production.rb +80 -0
  54. data/spec/dummy/config/environments/test.rb +43 -0
  55. data/spec/dummy/config/initializers/assets.rb +10 -0
  56. data/spec/dummy/config/initializers/backtrace_silencers.rb +9 -0
  57. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  58. data/spec/dummy/config/initializers/doorkeeper.rb +94 -0
  59. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  60. data/spec/dummy/config/initializers/inflections.rb +18 -0
  61. data/spec/dummy/config/initializers/mime_types.rb +6 -0
  62. data/spec/dummy/config/initializers/secret_token.rb +6 -0
  63. data/spec/dummy/config/initializers/session_store.rb +5 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  65. data/spec/dummy/config/locales/doorkeeper.en.yml +71 -0
  66. data/spec/dummy/config/locales/en.yml +23 -0
  67. data/spec/dummy/config/routes.rb +8 -0
  68. data/spec/dummy/config/secrets.yml +22 -0
  69. data/spec/dummy/config.ru +4 -0
  70. data/spec/dummy/db/migrate/20140915153344_create_users.rb +11 -0
  71. data/spec/dummy/db/migrate/20140915160601_create_doorkeeper_tables.rb +43 -0
  72. data/spec/dummy/db/schema.rb +62 -0
  73. data/spec/dummy/lib/assets/.keep +0 -0
  74. data/spec/dummy/log/.keep +0 -0
  75. data/spec/dummy/public/404.html +67 -0
  76. data/spec/dummy/public/422.html +67 -0
  77. data/spec/dummy/public/500.html +66 -0
  78. data/spec/dummy/public/favicon.ico +0 -0
  79. data/spec/factories/access_token.rb +13 -0
  80. data/spec/factories/application.rb +8 -0
  81. data/spec/factories/user.rb +7 -0
  82. data/spec/intergration/oauth2_default_strategy_spec.rb +189 -0
  83. data/spec/intergration/oauth2_protected_strategy_spec.rb +199 -0
  84. data/spec/intergration/oauth2_swagger_strategy_spec.rb +156 -0
  85. data/spec/lib/generators/wine_bouncer/initializer_generator_spec.rb +19 -0
  86. data/spec/lib/wine_bouncer/auth_methods/auth_methods_spec.rb +105 -0
  87. data/spec/lib/wine_bouncer/auth_strategies/default_spec.rb +76 -0
  88. data/spec/lib/wine_bouncer/auth_strategies/swagger_spec.rb +115 -0
  89. data/spec/rails_helper.rb +79 -0
  90. data/spec/shared/orm/active_record.rb +4 -0
  91. data/spec/spec_helper.rb +95 -0
  92. data/wine_bouncer.gemspec +33 -0
  93. metadata +386 -0
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ describe ::WineBouncer::AuthMethods do
6
+ let(:tested_class) do
7
+ Class.new do
8
+ include ::WineBouncer::AuthMethods
9
+ end.new
10
+ end
11
+ let(:user) { FactoryBot.create(:user) }
12
+ let(:token) { FactoryBot.create :clientless_access_token, resource_owner_id: user.id, scopes: 'public' }
13
+
14
+ context 'doorkeeper_access_token' do
15
+ it 'sets and gets a token' do
16
+ tested_class.doorkeeper_access_token = token
17
+ expect(tested_class.doorkeeper_access_token).to eq(token)
18
+ end
19
+ end
20
+
21
+ context 'has_resource_owner?' do
22
+ it 'gives true when the token has an resource owner' do
23
+ tested_class.doorkeeper_access_token = token
24
+
25
+ expect(tested_class.has_resource_owner?).to be true
26
+ end
27
+
28
+ it 'gives false when the class an no token' do
29
+ expect(tested_class.has_resource_owner?).to be false
30
+ end
31
+
32
+ it 'gives false when the token has no resource owner' do
33
+ token.resource_owner_id = nil
34
+ tested_class.doorkeeper_access_token = token
35
+
36
+ expect(tested_class.has_resource_owner?).to be false
37
+ end
38
+ end
39
+
40
+ context 'has_doorkeeper_token?' do
41
+ it 'returns true when the class has a token' do
42
+ tested_class.doorkeeper_access_token = token
43
+ expect(tested_class.has_doorkeeper_token?).to be true
44
+ end
45
+
46
+ it 'returns false when the class has no token' do
47
+ expect(tested_class.has_doorkeeper_token?).to be false
48
+ end
49
+ end
50
+
51
+ context 'client_credential_token?' do
52
+ it 'return true if the doorkeeper token is aquired through client_credential authentication' do
53
+ token.resource_owner_id = nil
54
+ tested_class.doorkeeper_access_token = token
55
+ expect(tested_class.client_credential_token?).to be true
56
+ end
57
+
58
+ it 'return false if no token is set' do
59
+ token.resource_owner_id = nil
60
+ tested_class.doorkeeper_access_token
61
+ expect(tested_class.client_credential_token?).to be false
62
+ end
63
+
64
+ it 'return false if the token has a resource_owner' do
65
+ token.resource_owner_id = 2
66
+ tested_class.doorkeeper_access_token = token
67
+ expect(tested_class.client_credential_token?).to be false
68
+ end
69
+ end
70
+
71
+ context 'protected_endpoint?' do
72
+ it 'when set true it returns true' do
73
+ tested_class.protected_endpoint = true
74
+ expect(tested_class.protected_endpoint?).to be true
75
+ end
76
+
77
+ it 'when set false it returns false' do
78
+ tested_class.protected_endpoint = false
79
+ expect(tested_class.protected_endpoint?).to be false
80
+ end
81
+
82
+ it 'defaults returns false if not set' do
83
+ expect(tested_class.protected_endpoint?).to be false
84
+ end
85
+ end
86
+
87
+ context 'resource_owner' do
88
+ it 'runs the configured block' do
89
+ result = 'called block'
90
+ foo = proc { result }
91
+
92
+ WineBouncer.configure do |c|
93
+ c.auth_strategy = :default
94
+ c.define_resource_owner(&foo)
95
+ end
96
+
97
+ expect(tested_class.resource_owner).to be(result)
98
+ end
99
+
100
+ it 'raises an argument error when the block is not configured' do
101
+ WineBouncer.configuration = WineBouncer::Configuration.new
102
+ expect { tested_class.resource_owner }.to raise_error(WineBouncer::Errors::UnconfiguredError)
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+ require 'wine_bouncer/auth_strategies/default'
5
+
6
+ describe ::WineBouncer::AuthStrategies::Default do
7
+ subject(:klass) { ::WineBouncer::AuthStrategies::Default.new }
8
+
9
+ let(:scopes) { %w(public private) }
10
+ let(:scopes_hash) { { scopes: scopes } }
11
+ let(:auth_context) { { route_options: { auth: scopes_hash } } }
12
+
13
+ context 'endpoint_authorizations' do
14
+ it 'returns the auth key of the authentication hash.' do
15
+ context_double = double()
16
+ allow(context_double).to receive(:options) { auth_context }
17
+ klass.api_context = context_double
18
+ expect(klass.send(:endpoint_authorizations)).to eq(scopes_hash)
19
+ end
20
+
21
+ it 'returns nil when the authentication key has no hash key.' do
22
+ context_double = double()
23
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_hash } } }
24
+ klass.api_context = context_double
25
+ expect(klass.send(:endpoint_authorizations)).to eq(nil)
26
+ end
27
+ end
28
+
29
+ context 'endpoint_protected?' do
30
+ it 'returns true when the context has the auth key.' do
31
+ context_double = double()
32
+ allow(context_double).to receive(:options) { auth_context }
33
+ klass.api_context = context_double
34
+ expect(klass.endpoint_protected?).to eq(true)
35
+ end
36
+
37
+ it 'returns false when the context has no auth key.' do
38
+ context_double = double()
39
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_hash } } }
40
+ klass.api_context = context_double
41
+ expect(klass.endpoint_protected?).to eq(false)
42
+ end
43
+ end
44
+
45
+ context 'has_auth_scopes?' do
46
+ it 'returns true when the context has the auth key.' do
47
+ context_double = double()
48
+ allow(context_double).to receive(:options) { auth_context }
49
+ klass.api_context = context_double
50
+ expect(klass.has_auth_scopes?).to eq(true)
51
+ end
52
+
53
+ it 'returns false when the context has no auth key.' do
54
+ context_double = double()
55
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_hash } } }
56
+ klass.api_context = context_double
57
+ expect(klass.has_auth_scopes?).to eq(false)
58
+ end
59
+
60
+ it 'returns false when the auth scopes contain a blank scope array' do
61
+ context_double = double()
62
+ allow(context_double).to receive(:options) { { route_options: { auth: { scopes: [] } } } }
63
+ klass.api_context = context_double
64
+ expect(klass.has_auth_scopes?).to eq(false)
65
+ end
66
+ end
67
+
68
+ context 'auth_scopes' do
69
+ it 'returns an array of scopes' do
70
+ context_double = double()
71
+ allow(context_double).to receive(:options) { auth_context }
72
+ klass.api_context = context_double
73
+ expect(klass.auth_scopes).to eq([:public, :private])
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+ require 'wine_bouncer/auth_strategies/swagger'
5
+
6
+ describe ::WineBouncer::AuthStrategies::Swagger do
7
+ subject(:klass) { ::WineBouncer::AuthStrategies::Swagger.new }
8
+
9
+ let(:scopes) { [{ scope: 'private', description: 'anything' },{ scope: 'public', description: 'anything' }] }
10
+ let(:scopes_map) { { oauth2: scopes } }
11
+ let(:auth_context) { { route_options: { authorizations: scopes_map } } }
12
+
13
+ context 'endpoint_authorizations' do
14
+ it 'returns the auth key of the authentication hash.' do
15
+ context_double = double()
16
+ allow(context_double).to receive(:options) { auth_context }
17
+ klass.api_context = context_double
18
+ expect(klass.send(:endpoint_authorizations)).to eq(scopes_map)
19
+ end
20
+
21
+ it 'returns nil when the authentication key has no hash key.' do
22
+ context_double = double()
23
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_map } } }
24
+ klass.api_context = context_double
25
+ expect(klass.send(:endpoint_authorizations)).to eq(nil)
26
+ end
27
+ end
28
+
29
+ context 'has_authorizations?' do
30
+ it 'returns true when it has an authentication hash.' do
31
+ context_double = double()
32
+ allow(context_double).to receive(:options) { auth_context }
33
+ klass.api_context = context_double
34
+ expect(klass.send(:has_authorizations?)).to eq(true)
35
+ end
36
+
37
+ it 'returns false when there is no authentication key.' do
38
+ context_double = double()
39
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_map } } }
40
+ klass.api_context = context_double
41
+ expect(klass.send(:has_authorizations?)).to eq(false)
42
+ end
43
+ end
44
+
45
+ context 'authorization_type_oauth2' do
46
+ it 'returns the scopes.' do
47
+ context_double = double()
48
+ allow(context_double).to receive(:options) { auth_context }
49
+ klass.api_context = context_double
50
+ expect(klass.send(:authorization_type_oauth2)).to eq(scopes)
51
+ end
52
+
53
+ it 'returns nil when there is no oauth2 key.' do
54
+ context_double = double()
55
+ allow(context_double).to receive(:options) { { route_options: { authorizations: { no_oauth: scopes } } } }
56
+ klass.api_context = context_double
57
+ expect(klass.send(:authorization_type_oauth2)).to eq(nil)
58
+ end
59
+ end
60
+
61
+ context 'endpoint_protected?' do
62
+ it 'returns true when the context has the auth key.' do
63
+ context_double = double()
64
+ allow(context_double).to receive(:options) { auth_context }
65
+ klass.api_context = context_double
66
+ expect(klass.endpoint_protected?).to eq(true)
67
+ end
68
+
69
+ it 'returns false when the context has no auth key.' do
70
+ context_double = double()
71
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_map } } }
72
+ klass.api_context = context_double
73
+ expect(klass.endpoint_protected?).to eq(false)
74
+ end
75
+ end
76
+
77
+ context 'has_auth_scopes?' do
78
+ it 'returns true when the context has the auth key.' do
79
+ context_double = double()
80
+ allow(context_double).to receive(:options) { auth_context }
81
+ klass.api_context = context_double
82
+ expect(klass.has_auth_scopes?).to eq(true)
83
+ end
84
+
85
+ it 'returns false when the context has no authorizations key.' do
86
+ context_double = double()
87
+ allow(context_double).to receive(:options) { { route_options: { some: scopes_map } } }
88
+ klass.api_context = context_double
89
+ expect(klass.has_auth_scopes?).to eq(false)
90
+ end
91
+
92
+ it 'returns false when the context has no oauth2 key.' do
93
+ context_double = double()
94
+ allow(context_double).to receive(:options) { { route_options: { authorizations: { no_oauth: scopes } } } }
95
+ klass.api_context = context_double
96
+ expect(klass.has_auth_scopes?).to eq(false)
97
+ end
98
+
99
+ it 'returns false when the auth scopes contain a blank scope array' do
100
+ context_double = double()
101
+ allow(context_double).to receive(:options) { { route_options: { authorizations: { oauth2: [] } } } }
102
+ klass.api_context = context_double
103
+ expect(klass.has_auth_scopes?).to eq(false)
104
+ end
105
+ end
106
+
107
+ context 'auth_scopes' do
108
+ it 'returns an array of scopes' do
109
+ context_double = double()
110
+ allow(context_double).to receive(:options) { auth_context }
111
+ klass.api_context = context_double
112
+ expect(klass.auth_scopes).to eq([:private, :public])
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ ORM = (ENV['orm'] || :active_record).to_sym
6
+ require 'spec_helper'
7
+ require File.expand_path('../dummy/config/environment', __FILE__)
8
+ require 'rspec/rails'
9
+ require 'wine_bouncer'
10
+ require 'factory_bot'
11
+ require 'database_cleaner'
12
+
13
+ # Add additional requires below this line. Rails is not loaded until this point!
14
+
15
+ # Requires supporting ruby files with custom matchers and macros, etc, in
16
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
17
+ # run as spec files by default. This means that files in spec/support that end
18
+ # in _spec.rb will both be required and run as specs, causing the specs to be
19
+ # run twice. It is recommended that you do not name files matching this glob to
20
+ # end with _spec.rb. You can configure this pattern with the --pattern
21
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
22
+ #
23
+ # The following line is provided for convenience purposes. It has the downside
24
+ # of increasing the boot-up time by auto-requiring all files in the support
25
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
26
+ # require only the support files necessary.
27
+ #
28
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
29
+
30
+ # Checks for pending migrations before tests are run.
31
+ # If you are not using ActiveRecord, you can remove this line.
32
+ #ActiveRecord::Migration.maintain_test_schema!
33
+
34
+ module ApiHelper
35
+ include Rack::Test::Methods
36
+
37
+ def app
38
+ Rails.application
39
+ end
40
+ end
41
+
42
+ def orm_name
43
+ orm = Doorkeeper.configuration.orm
44
+ [:mongoid2, :mongoid3, :mongoid4].include?(orm.to_sym) ? :mongoid : orm
45
+ end
46
+
47
+ require "shared/orm/#{orm_name}"
48
+
49
+ FactoryBot.find_definitions
50
+
51
+ RSpec.configure do |config|
52
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
53
+ #config.fixture_path = "#{::Rails.root}/spec/fixtures"
54
+
55
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
56
+ # examples within a transaction, remove the following line or assign false
57
+ # instead of true.
58
+
59
+ config.include FactoryBot::Syntax::Methods
60
+ config.include ApiHelper, type: :api
61
+
62
+ config.use_transactional_fixtures = false
63
+
64
+ config.infer_spec_type_from_file_location!
65
+
66
+ config.infer_base_class_for_anonymous_controllers = false
67
+
68
+ config.before do
69
+ DatabaseCleaner.start
70
+ FactoryBot.lint
71
+ # Doorkeeper.configure { orm :active_record }
72
+ end
73
+
74
+ config.after do
75
+ DatabaseCleaner.clean
76
+ end
77
+
78
+ config.order = 'random'
79
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ ActiveRecord::Migration.verbose = false
4
+ load Rails.root + 'db/schema.rb'
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
6
+ # file to always be loaded, without a need to explicitly require it in any files.
7
+ #
8
+ # Given that it is always loaded, you are encouraged to keep this file as
9
+ # light-weight as possible. Requiring heavyweight dependencies from this file
10
+ # will add to the boot time of your test suite on EVERY test run, even for an
11
+ # individual file that may not need all of that loaded. Instead, consider making
12
+ # a separate helper file that requires the additional dependencies and performs
13
+ # the additional setup, and require it from the spec files that actually need it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ require 'simplecov'
21
+ SimpleCov.start
22
+
23
+ RSpec.configure do |config|
24
+ # rspec-expectations config goes here. You can use an alternate
25
+ # assertion/expectation library such as wrong or the stdlib/minitest
26
+ # assertions if you prefer.
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+
38
+ # rspec-mocks config goes here. You can use an alternate test double
39
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
40
+ config.mock_with :rspec do |mocks|
41
+ # Prevents you from mocking or stubbing a method that does not exist on
42
+ # a real object. This is generally recommended, and will default to
43
+ # `true` in RSpec 4.
44
+ mocks.verify_partial_doubles = true
45
+ end
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # These two settings work together to allow you to limit a spec run
51
+ # to individual examples or groups you care about by tagging them with
52
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
53
+ # get run.
54
+ config.filter_run :focus
55
+ config.run_all_when_everything_filtered = true
56
+
57
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
58
+ # For more details, see:
59
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
60
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
61
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
62
+ config.disable_monkey_patching!
63
+
64
+ # This setting enables warnings. It's recommended, but in some cases may
65
+ # be too noisy due to issues in dependencies.
66
+ config.warnings = true
67
+
68
+ # Many RSpec users commonly either run the entire suite or an individual
69
+ # file, and it's useful to allow more verbose output when running an
70
+ # individual spec file.
71
+ if config.files_to_run.one?
72
+ # Use the documentation formatter for detailed output,
73
+ # unless a formatter has already been configured
74
+ # (e.g. via a command-line flag).
75
+ config.default_formatter = 'doc'
76
+ end
77
+
78
+ # Print the 10 slowest examples and example groups at the
79
+ # end of the spec run, to help surface which specs are running
80
+ # particularly slow.
81
+ config.profile_examples = 10
82
+
83
+ # Run specs in random order to surface order dependencies. If you find an
84
+ # order dependency and want to debug it, you can fix the order by providing
85
+ # the seed, which is printed after each run.
86
+ # --seed 1234
87
+ config.order = :random
88
+
89
+ # Seed global randomization in this process using the `--seed` CLI option.
90
+ # Setting this allows you to use `--seed` to deterministically reproduce
91
+ # test failures related to randomization by passing the same `--seed` value
92
+ # as the one that triggered the failure.
93
+ Kernel.srand config.seed
94
+ =end
95
+ end
@@ -0,0 +1,33 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'wine_bouncer/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'privy_wine_bouncer'
7
+ spec.version = WineBouncer::VERSION
8
+ spec.authors = ['Achmad Chun Chun']
9
+ spec.email = ['achmad.chun@privy.id']
10
+ spec.summary = %q{A Ruby gem that allows Oauth2 protection with Doorkeeper for Grape Api's}
11
+ spec.homepage = 'https://github.com/privy-ruby/wine_bouncer_gem'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.add_runtime_dependency 'grape', '>= 0.10'
20
+ spec.add_runtime_dependency 'doorkeeper', '>= 1.4', '< 6.0'
21
+
22
+ spec.add_development_dependency 'railties'
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake', '~> 11.0'
25
+ spec.add_development_dependency 'rspec-rails', '~> 3.5.0'
26
+ spec.add_development_dependency 'factory_bot', '~> 4.8'
27
+ spec.add_development_dependency 'generator_spec', '~> 0.9.0'
28
+ spec.add_development_dependency 'sqlite3'
29
+ spec.add_development_dependency 'database_cleaner', '~> 1.6'
30
+ spec.add_development_dependency 'rubocop', '0.58.2'
31
+ spec.add_development_dependency 'yard', '~> 0.9.16'
32
+ spec.add_development_dependency 'simplecov'
33
+ end