openstax_api 8.3.1 → 9.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/controllers/openstax/api/v1/api_controller.rb +17 -12
- data/lib/openstax/api/engine.rb +2 -0
- data/lib/openstax/api/roar.rb +24 -19
- data/lib/openstax/api/rspec_helpers.rb +41 -42
- data/lib/openstax/api/version.rb +1 -1
- metadata +31 -162
- data/spec/controllers/openstax/api/v1/api_controller_spec.rb +0 -176
- data/spec/dummy/README.md +0 -1
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/api/v1/dummy_controller.rb +0 -23
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/models/user.rb +0 -2
- data/spec/dummy/app/representers/user_representer.rb +0 -13
- data/spec/dummy/app/representers/user_search_representer.rb +0 -5
- data/spec/dummy/app/routines/search_users.rb +0 -42
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -23
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -7
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -78
- data/spec/dummy/config/environments/test.rb +0 -39
- data/spec/dummy/config/initializers/assets.rb +0 -8
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/doorkeeper.rb +0 -75
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/openstax_api.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -6
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/0_create_doorkeeper_tables.rb +0 -42
- data/spec/dummy/db/migrate/1_create_users.rb +0 -16
- data/spec/dummy/db/schema.rb +0 -68
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/controller_includes.rb +0 -3
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/user.rb +0 -8
- data/spec/lib/openstax/api/apipie_spec.rb +0 -15
- data/spec/lib/openstax/api/constraints_spec.rb +0 -84
- data/spec/lib/openstax/api/doorkeeper_application_includes_spec.rb +0 -17
- data/spec/lib/openstax/api/params_spec.rb +0 -78
- data/spec/lib/openstax/api/representable_schema_printer_spec.rb +0 -27
- data/spec/lib/openstax/api/roar_spec.rb +0 -45
- data/spec/lib/openstax/api/routing_mapper_includes_spec.rb +0 -20
- data/spec/lib/openstax_api_spec.rb +0 -19
- data/spec/models/openstax/api/api_user_spec.rb +0 -47
- data/spec/rails_helper.rb +0 -54
- data/spec/representers/openstax/api/v1/abstract_search_representer_spec.rb +0 -144
- data/spec/spec_helper.rb +0 -86
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
module OpenStax
|
4
|
-
module Api
|
5
|
-
module V1
|
6
|
-
describe Roar do
|
7
|
-
let!(:controller) { OpenStax::Api::V1::ApiController.new }
|
8
|
-
|
9
|
-
it 'adds methods to ApiController instance' do
|
10
|
-
expect(controller).to respond_to(:standard_index)
|
11
|
-
expect(controller).to respond_to(:standard_search)
|
12
|
-
expect(controller).to respond_to(:standard_create)
|
13
|
-
expect(controller).to respond_to(:standard_nested_create)
|
14
|
-
expect(controller).to respond_to(:standard_read)
|
15
|
-
expect(controller).to respond_to(:standard_update)
|
16
|
-
expect(controller).to respond_to(:standard_destroy)
|
17
|
-
expect(controller).to respond_to(:standard_restore)
|
18
|
-
expect(controller).to respond_to(:standard_sort)
|
19
|
-
expect(controller).to respond_to(:render_api_errors)
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'render_api_errors' do
|
23
|
-
it 'returns nil if errors is nil' do
|
24
|
-
expect(controller).not_to receive(:render)
|
25
|
-
expect(controller.render_api_errors(nil)).to be_nil
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'returns nil if errors is empty' do
|
29
|
-
expect(controller).not_to receive(:render)
|
30
|
-
expect(controller.render_api_errors([])).to be_nil
|
31
|
-
expect(controller.render_api_errors({})).to be_nil
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'returns the rendered response if there are errors' do
|
35
|
-
expect(controller).to receive(:render) do |options|
|
36
|
-
expect(options[:json]).to eq({ status: 422, errors: [{code: :error}] })
|
37
|
-
expect(options[:status]).to eq :unprocessable_entity
|
38
|
-
end
|
39
|
-
controller.render_api_errors(code: :error)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
module OpenStax
|
4
|
-
module Api
|
5
|
-
describe RoutingMapperIncludes do
|
6
|
-
it 'must add api method to ActionDispatch::Routing::Mapper' do
|
7
|
-
mapper = ActionDispatch::Routing::Mapper.new(Rails.application.routes)
|
8
|
-
expect(mapper).to respond_to(:api)
|
9
|
-
Rails.application.routes.draw do
|
10
|
-
api :v1 do
|
11
|
-
resource :dummy_models
|
12
|
-
end
|
13
|
-
end
|
14
|
-
route_names = Rails.application.routes.named_routes.names
|
15
|
-
expect(route_names).to include(:api)
|
16
|
-
expect(route_names).to include(:api_dummy_models)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
describe OpenStax::Api do
|
4
|
-
it 'is configurable' do
|
5
|
-
expect(OpenStax::Api.configuration).to respond_to(:user_class_name)
|
6
|
-
expect(OpenStax::Api.configuration).to respond_to(:current_user_method)
|
7
|
-
expect(OpenStax::Api.configuration).to respond_to(:routing_error_app)
|
8
|
-
|
9
|
-
expect(OpenStax::Api.configuration.user_class_name).to eq 'User'
|
10
|
-
|
11
|
-
OpenStax::Api.configure { |config| config.user_class_name = 'Test' }
|
12
|
-
|
13
|
-
expect(OpenStax::Api.configuration.user_class_name).to eq 'Test'
|
14
|
-
|
15
|
-
OpenStax::Api.configure { |config| config.user_class_name = 'User' }
|
16
|
-
|
17
|
-
expect(OpenStax::Api.configuration.user_class_name).to eq 'User'
|
18
|
-
end
|
19
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
module OpenStax
|
4
|
-
module Api
|
5
|
-
describe ApiUser do
|
6
|
-
let(:user) { FactoryBot.create :user }
|
7
|
-
let(:application) { double('Doorkeeper::Application') }
|
8
|
-
let(:doorkeeper_token) { double('Doorkeeper::AccessToken') }
|
9
|
-
let(:non_doorkeeper_user_proc) { lambda { user } }
|
10
|
-
|
11
|
-
context 'human user' do
|
12
|
-
let(:api_user) { ApiUser.new(nil, non_doorkeeper_user_proc) }
|
13
|
-
|
14
|
-
it 'has a human_user but no application' do
|
15
|
-
expect(api_user.application).to be_nil
|
16
|
-
expect(api_user.human_user).to eq(user)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'application with human user' do
|
21
|
-
let(:api_user) { ApiUser.new(doorkeeper_token,
|
22
|
-
non_doorkeeper_user_proc) }
|
23
|
-
|
24
|
-
it 'has a human_user and an application' do
|
25
|
-
allow(doorkeeper_token).to receive(:application).and_return(application)
|
26
|
-
allow(doorkeeper_token).to receive(:resource_owner_id).and_return(user.id)
|
27
|
-
|
28
|
-
expect(api_user.application).to eq(application)
|
29
|
-
expect(api_user.human_user).to eq(user)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'application only' do
|
34
|
-
let(:api_user) { ApiUser.new(doorkeeper_token,
|
35
|
-
non_doorkeeper_user_proc) }
|
36
|
-
|
37
|
-
it 'has an application but no human_user' do
|
38
|
-
allow(doorkeeper_token).to receive(:application).and_return(application)
|
39
|
-
allow(doorkeeper_token).to receive(:resource_owner_id).and_return(nil)
|
40
|
-
|
41
|
-
expect(api_user.application).to eq(application)
|
42
|
-
expect(api_user.human_user).to be_nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/spec/rails_helper.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] ||= 'test'
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
5
|
-
require 'rspec/rails'
|
6
|
-
require 'factory_bot_rails'
|
7
|
-
require 'faker'
|
8
|
-
require 'squeel'
|
9
|
-
|
10
|
-
# Add additional requires below this line. Rails is not loaded until this point!
|
11
|
-
|
12
|
-
# Requires supporting ruby files with custom matchers and macros, etc, in
|
13
|
-
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
14
|
-
# run as spec files by default. This means that files in spec/support that end
|
15
|
-
# in _spec.rb will both be required and run as specs, causing the specs to be
|
16
|
-
# run twice. It is recommended that you do not name files matching this glob to
|
17
|
-
# end with _spec.rb. You can configure this pattern with the --pattern
|
18
|
-
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
19
|
-
#
|
20
|
-
# The following line is provided for convenience purposes. It has the downside
|
21
|
-
# of increasing the boot-up time by auto-requiring all files in the support
|
22
|
-
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
23
|
-
# require only the support files necessary.
|
24
|
-
#
|
25
|
-
# Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
26
|
-
|
27
|
-
# Checks for pending migrations before tests are run.
|
28
|
-
# If you are not using ActiveRecord, you can remove this line.
|
29
|
-
ActiveRecord::Migration.maintain_test_schema!
|
30
|
-
|
31
|
-
RSpec.configure do |config|
|
32
|
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
33
|
-
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
34
|
-
|
35
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
36
|
-
# examples within a transaction, remove the following line or assign false
|
37
|
-
# instead of true.
|
38
|
-
# config.use_transactional_fixtures = true
|
39
|
-
|
40
|
-
# RSpec Rails can automatically mix in different behaviours to your tests
|
41
|
-
# based on their file location, for example enabling you to call `get` and
|
42
|
-
# `post` in specs under `spec/controllers`.
|
43
|
-
#
|
44
|
-
# You can disable this behaviour by removing the line below, and instead
|
45
|
-
# explicitly tag your specs with their type, e.g.:
|
46
|
-
#
|
47
|
-
# RSpec.describe UsersController, :type => :controller do
|
48
|
-
# # ...
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# The different available types are documented in the features, such as in
|
52
|
-
# https://relishapp.com/rspec/rspec-rails/docs
|
53
|
-
config.infer_spec_type_from_file_location!
|
54
|
-
end
|
@@ -1,144 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
module OpenStax
|
4
|
-
module Api
|
5
|
-
module V1
|
6
|
-
describe AbstractSearchRepresenter do
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
100.times do
|
10
|
-
FactoryBot.create(:user)
|
11
|
-
end
|
12
|
-
|
13
|
-
User.where{name.like "% doe%"}.delete_all
|
14
|
-
|
15
|
-
john_doe = FactoryBot.create :user, name: "John Doe",
|
16
|
-
username: "doejohn",
|
17
|
-
email: "john@doe.com"
|
18
|
-
jane_doe = FactoryBot.create :user, name: "Jane Doe",
|
19
|
-
username: "doejane",
|
20
|
-
email: "jane@doe.com"
|
21
|
-
jack_doe = FactoryBot.create :user, name: "Jack Doe",
|
22
|
-
username: "doejack",
|
23
|
-
email: "jack@doe.com"
|
24
|
-
|
25
|
-
@john_hash = JSON.parse(UserRepresenter.new(john_doe).to_json)
|
26
|
-
@jane_hash = JSON.parse(UserRepresenter.new(jane_doe).to_json)
|
27
|
-
@jack_hash = JSON.parse(UserRepresenter.new(jack_doe).to_json)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "represents search results" do
|
31
|
-
outputs = SearchUsers.call(query: 'last_name:dOe').outputs
|
32
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
33
|
-
total_count = response['total_count']
|
34
|
-
items = response['items']
|
35
|
-
|
36
|
-
expect(total_count).to eq 3
|
37
|
-
expect(items).to include(@john_hash)
|
38
|
-
expect(items).to include(@jane_hash)
|
39
|
-
expect(items).to include(@jack_hash)
|
40
|
-
|
41
|
-
outputs = SearchUsers.call(query: 'first_name:jOhN last_name:DoE')
|
42
|
-
.outputs
|
43
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
44
|
-
total_count = response['total_count']
|
45
|
-
items = response['items']
|
46
|
-
|
47
|
-
expect(total_count).to eq 1
|
48
|
-
expect(items).to include(@john_hash)
|
49
|
-
expect(items).not_to include(@jane_hash)
|
50
|
-
expect(items).not_to include(@jack_hash)
|
51
|
-
|
52
|
-
outputs = SearchUsers.call(
|
53
|
-
query: 'first_name:JoHn,JaNe last_name:dOe'
|
54
|
-
).outputs
|
55
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
56
|
-
total_count = response['total_count']
|
57
|
-
items = response['items']
|
58
|
-
|
59
|
-
expect(total_count).to eq 2
|
60
|
-
expect(items).to include(@john_hash)
|
61
|
-
expect(items).to include(@jane_hash)
|
62
|
-
expect(items).not_to include(@jack_hash)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "represents ordered results" do
|
66
|
-
outputs = SearchUsers.call(query: 'username:DoE',
|
67
|
-
order_by: 'cReAtEd_At AsC, iD')
|
68
|
-
.outputs
|
69
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
70
|
-
total_count = response['total_count']
|
71
|
-
items = response['items']
|
72
|
-
|
73
|
-
expect(total_count).to eq 3
|
74
|
-
expect(items[0]).to eq @john_hash
|
75
|
-
expect(items[1]).to eq @jane_hash
|
76
|
-
expect(items[2]).to eq @jack_hash
|
77
|
-
|
78
|
-
outputs = SearchUsers.call(query: 'username:dOe',
|
79
|
-
order_by: 'CrEaTeD_aT dEsC, Id DeSc')
|
80
|
-
.outputs
|
81
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
82
|
-
total_count = response['total_count']
|
83
|
-
items = response['items']
|
84
|
-
|
85
|
-
expect(total_count).to eq 3
|
86
|
-
expect(items[0]).to eq @jack_hash
|
87
|
-
expect(items[1]).to eq @jane_hash
|
88
|
-
expect(items[2]).to eq @john_hash
|
89
|
-
end
|
90
|
-
|
91
|
-
it "represents paginated results" do
|
92
|
-
user_count = User.count
|
93
|
-
|
94
|
-
outputs = SearchUsers.call(query: '').outputs
|
95
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
96
|
-
total_count = response['total_count']
|
97
|
-
items = response['items']
|
98
|
-
|
99
|
-
expect(total_count).to eq user_count
|
100
|
-
expect(items.count).to eq user_count
|
101
|
-
|
102
|
-
outputs = SearchUsers.call(query: '', per_page: 20).outputs
|
103
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
104
|
-
total_count = response['total_count']
|
105
|
-
items = response['items']
|
106
|
-
|
107
|
-
expect(total_count).to eq user_count
|
108
|
-
expect(items.count).to eq 20
|
109
|
-
|
110
|
-
for page in 1..5
|
111
|
-
outputs = SearchUsers.call(query: '',
|
112
|
-
page: page, per_page: 20).outputs
|
113
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
114
|
-
total_count = response['total_count']
|
115
|
-
items = response['items']
|
116
|
-
|
117
|
-
expect(total_count).to eq user_count
|
118
|
-
expect(items.count).to eq 20
|
119
|
-
end
|
120
|
-
|
121
|
-
outputs = SearchUsers.call(query: '',
|
122
|
-
page: 1000, per_page: 20).outputs
|
123
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
124
|
-
total_count = response['total_count']
|
125
|
-
items = response['items']
|
126
|
-
|
127
|
-
expect(total_count).to eq user_count
|
128
|
-
expect(items.count).to eq 0
|
129
|
-
end
|
130
|
-
|
131
|
-
it "removes duplicate search results" do
|
132
|
-
outputs = Hashie::Mash.new(items: [@john_hash, @john_hash, @jane_hash])
|
133
|
-
response = JSON.parse(UserSearchRepresenter.new(outputs).to_json)
|
134
|
-
total_count = response['total_count']
|
135
|
-
items = response['items']
|
136
|
-
|
137
|
-
expect(total_count).to eq 2
|
138
|
-
expect(items.count).to eq 2
|
139
|
-
end
|
140
|
-
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
require 'rspec/core'
|
2
|
-
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
3
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
5
|
-
# file to always be loaded, without a need to explicitly require it in any files.
|
6
|
-
#
|
7
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
-
# a separate helper file that requires the additional dependencies and performs
|
12
|
-
# the additional setup, and require it from the spec files that actually need it.
|
13
|
-
#
|
14
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
15
|
-
# users commonly want.
|
16
|
-
#
|
17
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
18
|
-
RSpec.configure do |config|
|
19
|
-
# rspec-expectations config goes here. You can use an alternate
|
20
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
-
# assertions if you prefer.
|
22
|
-
config.expect_with :rspec do |expectations|
|
23
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
-
# and `failure_message` of custom matchers include text for helper methods
|
25
|
-
# defined using `chain`, e.g.:
|
26
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
-
# # => "be bigger than 2 and smaller than 4"
|
28
|
-
# ...rather than:
|
29
|
-
# # => "be bigger than 2"
|
30
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
-
end
|
32
|
-
|
33
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
-
config.mock_with :rspec do |mocks|
|
36
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
-
# a real object. This is generally recommended, and will default to
|
38
|
-
# `true` in RSpec 4.
|
39
|
-
mocks.verify_partial_doubles = true
|
40
|
-
end
|
41
|
-
|
42
|
-
# The settings below are suggested to provide a good initial experience
|
43
|
-
# with RSpec, but feel free to customize to your heart's content.
|
44
|
-
=begin
|
45
|
-
# These two settings work together to allow you to limit a spec run
|
46
|
-
# to individual examples or groups you care about by tagging them with
|
47
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
48
|
-
# get run.
|
49
|
-
config.filter_run :focus
|
50
|
-
config.run_all_when_everything_filtered = true
|
51
|
-
|
52
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
53
|
-
# For more details, see:
|
54
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
55
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
56
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
57
|
-
config.disable_monkey_patching!
|
58
|
-
|
59
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
60
|
-
# file, and it's useful to allow more verbose output when running an
|
61
|
-
# individual spec file.
|
62
|
-
if config.files_to_run.one?
|
63
|
-
# Use the documentation formatter for detailed output,
|
64
|
-
# unless a formatter has already been configured
|
65
|
-
# (e.g. via a command-line flag).
|
66
|
-
config.default_formatter = 'doc'
|
67
|
-
end
|
68
|
-
|
69
|
-
# Print the 10 slowest examples and example groups at the
|
70
|
-
# end of the spec run, to help surface which specs are running
|
71
|
-
# particularly slow.
|
72
|
-
config.profile_examples = 10
|
73
|
-
|
74
|
-
# Run specs in random order to surface order dependencies. If you find an
|
75
|
-
# order dependency and want to debug it, you can fix the order by providing
|
76
|
-
# the seed, which is printed after each run.
|
77
|
-
# --seed 1234
|
78
|
-
config.order = :random
|
79
|
-
|
80
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
81
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
82
|
-
# test failures related to randomization by passing the same `--seed` value
|
83
|
-
# as the one that triggered the failure.
|
84
|
-
Kernel.srand config.seed
|
85
|
-
=end
|
86
|
-
end
|