rspeckled 0.0.54 → 0.0.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rspeckled/helpers/responses.rb +1 -3
- data/lib/rspeckled/plugins/authentication.rb +5 -5
- data/lib/rspeckled/plugins/awesome_print.rb +67 -75
- data/lib/rspeckled/plugins/bullet.rb +11 -20
- data/lib/rspeckled/plugins/capybara.rb +109 -120
- data/lib/rspeckled/plugins/carrier_wave.rb +18 -26
- data/lib/rspeckled/plugins/database_cleaner.rb +23 -37
- data/lib/rspeckled/plugins/devise.rb +9 -18
- data/lib/rspeckled/plugins/dox.rb +35 -43
- data/lib/rspeckled/plugins/elasticsearch.rb +17 -24
- data/lib/rspeckled/plugins/email.rb +4 -13
- data/lib/rspeckled/plugins/factory_bot.rb +13 -22
- data/lib/rspeckled/plugins/fakeredis.rb +1 -4
- data/lib/rspeckled/plugins/faraday.rb +49 -55
- data/lib/rspeckled/plugins/foreign_keys.rb +0 -4
- data/lib/rspeckled/plugins/garbage_collection.rb +31 -32
- data/lib/rspeckled/plugins/mongoid.rb +3 -10
- data/lib/rspeckled/plugins/omniauth.rb +30 -38
- data/lib/rspeckled/plugins/rails/strong_parameters.rb +8 -10
- data/lib/rspeckled/plugins/recaptcha.rb +2 -11
- data/lib/rspeckled/plugins/referehencible.rb +10 -19
- data/lib/rspeckled/plugins/request.rb +0 -4
- data/lib/rspeckled/plugins/shoulda.rb +20 -29
- data/lib/rspeckled/plugins/sidekiq.rb +21 -24
- data/lib/rspeckled/plugins/singleton.rb +0 -4
- data/lib/rspeckled/plugins/stripe.rb +17 -26
- data/lib/rspeckled/plugins/test_after_commit.rb +1 -6
- data/lib/rspeckled/plugins/timecop.rb +21 -28
- data/lib/rspeckled/plugins/vcr.rb +23 -37
- data/lib/rspeckled/plugins/webmock.rb +11 -18
- data/lib/rspeckled/plugins/wisper.rb +4 -12
- data/lib/rspeckled/plugins.rb +77 -31
- data/lib/rspeckled/spec_helpers/rspeckled.rb +0 -1
- data/lib/rspeckled/support.rb +13 -5
- data/lib/rspeckled/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +26 -24
- metadata.gz.sig +0 -0
- data/lib/rspeckled/plugins/code_climate.rb +0 -10
- data/lib/rspeckled/plugins/pretty_print.rb +0 -3
@@ -1,25 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# Devise Plugin
|
5
|
-
##############################################################################
|
3
|
+
Devise.stretches = 1
|
6
4
|
|
7
|
-
|
8
|
-
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.include Devise::Test::ControllerHelpers, :type => :controller
|
7
|
+
config.include Warden::Test::Helpers, :type => :feature
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
config.include Devise::Test::ControllerHelpers, :type => :controller
|
14
|
-
config.include Warden::Test::Helpers, :type => :feature
|
15
|
-
|
16
|
-
config.before(:all, :type => :feature) do |_example|
|
17
|
-
Warden.test_mode!
|
18
|
-
end
|
9
|
+
config.before(:all, :type => :feature) do |_example|
|
10
|
+
Warden.test_mode!
|
11
|
+
end
|
19
12
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
13
|
+
config.before(:each, :type => :controller) do |_example|
|
14
|
+
@request.env['devise.mapping'] = Devise.mappings[:user]
|
23
15
|
end
|
24
|
-
rescue LoadError
|
25
16
|
end
|
@@ -1,58 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.after(:each, :dox) do |example|
|
13
|
-
example.metadata[:request] = request
|
14
|
-
example.metadata[:response] = response
|
15
|
-
end
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.after(:each, :dox) do |example|
|
7
|
+
example.metadata[:request] = request
|
8
|
+
example.metadata[:response] = response
|
16
9
|
end
|
10
|
+
end
|
17
11
|
|
18
|
-
|
19
|
-
|
12
|
+
api_docs_folder = Pathname.pwd.join('docs', 'api')
|
13
|
+
api_docs_header = api_docs_folder.join('header.md')
|
20
14
|
|
21
|
-
|
15
|
+
api_docs_folder.mkpath
|
22
16
|
|
23
|
-
|
17
|
+
api_docs_folder.glob('**/*.rb').each { |f| require f }
|
24
18
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
titleized_application_name = Rails
|
20
|
+
.application
|
21
|
+
.class
|
22
|
+
.name
|
23
|
+
.split('::')[0]
|
24
|
+
.titleize
|
31
25
|
|
32
|
-
|
26
|
+
http_settings_file = Pathname.pwd.join('config', 'settings', 'http.yml')
|
33
27
|
|
34
|
-
|
35
|
-
|
28
|
+
host = if http_settings_file.exist?
|
29
|
+
http_settings = YAML.load(http_settings_file.read) # rubocop:disable Security/YAMLLoad
|
36
30
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
http_settings['production']['http']['base_url']
|
32
|
+
else
|
33
|
+
'http://api.lvh.me:5000'
|
34
|
+
end
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
unless api_docs_header.exist?
|
37
|
+
api_docs_header.write(<<~HEREDOC, :mode => 'w')
|
38
|
+
FORMAT: 1A
|
39
|
+
HOST: #{host}
|
46
40
|
|
47
|
-
|
41
|
+
# #{titleized_application_name}
|
48
42
|
|
49
|
-
|
50
|
-
|
43
|
+
HEREDOC
|
44
|
+
end
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
rescue LoadError
|
46
|
+
Dox.configure do |config|
|
47
|
+
config.header_file_path = api_docs_header
|
48
|
+
config.desc_folder_path = api_docs_folder
|
49
|
+
# config.headers_whitelist = ['Accept', 'X-Auth-Token']
|
58
50
|
end
|
@@ -1,34 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# Elasticsearch Plugin
|
5
|
-
##############################################################################
|
3
|
+
require 'elasticsearch-extensions'
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
config.before(:suite, :elasticsearch => lambda { |v| !!v }) do
|
12
|
-
Elasticsearch::Extensions::Test::Cluster.start(:port => 9200) unless Elasticsearch::Extensions::Test::Cluster.running?
|
13
|
-
end
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.before(:suite, :elasticsearch => lambda { |v| !!v }) do
|
7
|
+
Elasticsearch::Extensions::Test::Cluster.start(:port => 9200) unless Elasticsearch::Extensions::Test::Cluster.running?
|
8
|
+
end
|
14
9
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
config.around(:each, :elasticsearch => lambda { |v| !!v }) do |example|
|
11
|
+
model = case example.metadata[:elasticsearch]
|
12
|
+
when String
|
13
|
+
example.metadata[:elasticsearch].constantize
|
14
|
+
end
|
20
15
|
|
21
|
-
|
22
|
-
|
16
|
+
model.__elasticsearch__.client.indices.delete :index => '_all'
|
17
|
+
model.__elasticsearch__.create_index! :index => model.index_name
|
23
18
|
|
24
|
-
|
19
|
+
example.run
|
25
20
|
|
26
|
-
|
27
|
-
|
21
|
+
model.__elasticsearch__.client.indices.delete :index => '_all'
|
22
|
+
end
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
end
|
24
|
+
config.after(:suite, :elasticsearch => lambda { |v| !!v }) do
|
25
|
+
Elasticsearch::Extensions::Test::Cluster.stop(:port => 9200) if Elasticsearch::Extensions::Test::Cluster.running?
|
32
26
|
end
|
33
|
-
rescue LoadError
|
34
27
|
end
|
@@ -1,24 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
##############################################################################
|
4
|
-
# Email Plugin
|
5
|
-
##############################################################################
|
6
|
-
#
|
7
3
|
# The approach to this plugin is twofold. First it uses the excellent email_spec
|
8
4
|
# gem to add helpers and matchers to any spec file with :email => true set.
|
9
5
|
# Secondly, it will also clear all deliveries from ActionMailer if it is loaded.
|
10
6
|
#
|
11
7
|
# https://github.com/bmabey/email-spec/
|
12
|
-
#
|
13
|
-
begin
|
14
|
-
require 'email_spec'
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
21
|
-
rescue LoadError
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.include EmailSpec::Helpers, :email => true
|
11
|
+
config.include EmailSpec::Matchers, :email => true
|
12
|
+
config.include EmailSpec::MailerDeliveries, :email => true
|
22
13
|
end
|
23
14
|
|
24
15
|
if defined? ActionMailer
|
@@ -1,32 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# Factory Bot Plugin
|
5
|
-
##############################################################################
|
3
|
+
FactoryBot.definition_file_paths << './spec/factories'
|
6
4
|
|
7
|
-
|
8
|
-
|
5
|
+
if FactoryBot.configuration.factories.count.zero? &&
|
6
|
+
Rails.application.class.name.match(/Dummy/)
|
9
7
|
|
10
|
-
FactoryBot.
|
11
|
-
|
12
|
-
if FactoryBot.configuration.factories.count.zero? &&
|
13
|
-
Rails.application.class.name.match(/Dummy/)
|
14
|
-
|
15
|
-
FactoryBot.find_definitions
|
16
|
-
end
|
8
|
+
FactoryBot.find_definitions
|
9
|
+
end
|
17
10
|
|
18
|
-
|
19
|
-
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include FactoryBot::Syntax::Methods
|
20
13
|
|
21
|
-
|
22
|
-
|
14
|
+
config.before(:suite) do
|
15
|
+
FactoryBot.reload
|
23
16
|
|
24
|
-
|
25
|
-
|
17
|
+
load 'rspeckled/factories/sequences.rb'
|
18
|
+
end
|
26
19
|
|
27
|
-
|
28
|
-
|
29
|
-
end
|
20
|
+
config.before(:each) do
|
21
|
+
FactoryBot.rewind_sequences if FactoryBot.respond_to?(:rewind_sequences)
|
30
22
|
end
|
31
|
-
rescue LoadError
|
32
23
|
end
|
@@ -1,63 +1,57 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
class DetailedLogger < ::Faraday::Response::Middleware
|
12
|
-
def self.default_logger
|
13
|
-
require 'logger'
|
14
|
-
|
15
|
-
::Logger.new(STDOUT)
|
16
|
-
end
|
17
|
-
|
18
|
-
def initialize(app, logger = nil, program_name = nil)
|
19
|
-
super(app)
|
20
|
-
|
21
|
-
@logger = logger || self.class.default_logger
|
22
|
-
@program_name = program_name
|
23
|
-
end
|
24
|
-
|
25
|
-
def call(env)
|
26
|
-
@logger.info(@program_name) { curl_output('request', "#{env[:method].upcase} #{env[:url]}", env[:request_headers], env[:body]) }
|
27
|
-
|
28
|
-
super
|
29
|
-
end
|
30
|
-
|
31
|
-
def on_complete(env)
|
32
|
-
@logger.info(@program_name) { curl_output('response', "HTTP #{env[:status]}", env[:response_headers], env[:body]) }
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def curl_output(direction, summary, headers, body)
|
38
|
-
directional_arrow = (direction == 'request') ? '>' : '<'
|
39
|
-
color_code = (direction == 'request') ? 32 : 33
|
40
|
-
|
41
|
-
curl_formatted_headers = headers.map { |name, value|
|
42
|
-
colorize("#{directional_arrow} #{name}: #{value}", color_code)
|
43
|
-
}.join("\n")
|
44
|
-
|
45
|
-
[
|
46
|
-
'',
|
47
|
-
colorize("#{directional_arrow} #{summary}", color_code),
|
48
|
-
curl_formatted_headers,
|
49
|
-
'',
|
50
|
-
colorize(body, 37),
|
51
|
-
].join("\n")
|
52
|
-
end
|
53
|
-
|
54
|
-
def colorize(string, color_code)
|
55
|
-
"\e[#{color_code}m#{string}\e[0m"
|
56
|
-
end
|
3
|
+
module Rspeckled
|
4
|
+
module Faraday
|
5
|
+
module Middleware
|
6
|
+
class DetailedLogger < ::Faraday::Response::Middleware
|
7
|
+
def self.default_logger
|
8
|
+
require 'logger'
|
9
|
+
|
10
|
+
::Logger.new(STDOUT)
|
57
11
|
end
|
12
|
+
|
13
|
+
def initialize(app, logger = nil, program_name = nil)
|
14
|
+
super(app)
|
15
|
+
|
16
|
+
@logger = logger || self.class.default_logger
|
17
|
+
@program_name = program_name
|
58
18
|
end
|
19
|
+
|
20
|
+
def call(env)
|
21
|
+
@logger.info(@program_name) { curl_output('request', "#{env[:method].upcase} #{env[:url]}", env[:request_headers], env[:body]) }
|
22
|
+
|
23
|
+
super
|
59
24
|
end
|
25
|
+
|
26
|
+
def on_complete(env)
|
27
|
+
@logger.info(@program_name) { curl_output('response', "HTTP #{env[:status]}", env[:response_headers], env[:body]) }
|
60
28
|
end
|
61
29
|
|
62
|
-
|
30
|
+
private
|
31
|
+
|
32
|
+
def curl_output(direction, summary, headers, body)
|
33
|
+
directional_arrow = (direction == 'request') ? '>' : '<'
|
34
|
+
color_code = (direction == 'request') ? 32 : 33
|
35
|
+
|
36
|
+
curl_formatted_headers = headers.map { |name, value|
|
37
|
+
colorize("#{directional_arrow} #{name}: #{value}", color_code)
|
38
|
+
}.join("\n")
|
39
|
+
|
40
|
+
[
|
41
|
+
'',
|
42
|
+
colorize("#{directional_arrow} #{summary}", color_code),
|
43
|
+
curl_formatted_headers,
|
44
|
+
'',
|
45
|
+
colorize(body, 37),
|
46
|
+
].join("\n")
|
47
|
+
end
|
48
|
+
|
49
|
+
def colorize(string, color_code)
|
50
|
+
"\e[#{color_code}m#{string}\e[0m"
|
51
|
+
end
|
52
|
+
end
|
63
53
|
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
::Faraday::Response.register_middleware(:detailed_logger => Rspeckled::Faraday::Middleware::DetailedLogger)
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
##############################################################################
|
4
|
-
# Foreign Key Plugin
|
5
|
-
##############################################################################
|
6
|
-
|
7
3
|
RSpec.configure do |config|
|
8
4
|
config.around(:each, :disable_foreign_keys => lambda { |v| !!v }) do |example|
|
9
5
|
options = example.metadata[:disable_foreign_keys]
|
@@ -1,54 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
###
|
4
|
-
#
|
5
4
|
# Shamelessly stolen from http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection/
|
6
5
|
#
|
7
6
|
module Rspeckled
|
8
|
-
|
9
|
-
|
7
|
+
class DeferredGarbageCollection
|
8
|
+
THRESHOLD = (ENV['DEFER_GC'] || 20.0).to_f
|
10
9
|
|
11
|
-
|
10
|
+
@garbage_last_collected_at = nil
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def self.start
|
13
|
+
cycle_garbage_collector if enabled?
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
16
|
+
def self.reconsider
|
17
|
+
return unless enabled? && over_deferrment_threshold?
|
19
18
|
|
20
|
-
|
19
|
+
cycle_garbage_collector
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
self.garbage_last_collected_at = Time.now
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
def self.cycle_garbage_collector
|
25
|
+
GC.enable
|
26
|
+
GC.start
|
27
|
+
GC.disable
|
28
|
+
end
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
def self.over_deferrment_threshold?
|
31
|
+
time_since_garbage_last_collected >= THRESHOLD
|
32
|
+
end
|
34
33
|
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def self.enabled?
|
35
|
+
THRESHOLD.positive?
|
36
|
+
end
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
def self.time_since_garbage_last_collected
|
39
|
+
Time.now - garbage_last_collected_at
|
40
|
+
end
|
42
41
|
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
def self.garbage_last_collected_at
|
43
|
+
@garbage_last_collected_at || Time.now
|
44
|
+
end
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
46
|
+
class << self
|
47
|
+
attr_writer :garbage_last_collected_at
|
50
48
|
end
|
51
49
|
end
|
50
|
+
end
|
52
51
|
|
53
52
|
RSpec.configure do |config|
|
54
53
|
config.before(:all) do
|
@@ -1,14 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# Mongoid Plugin
|
5
|
-
##############################################################################
|
3
|
+
require 'mongoid-rspec'
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.include Mongoid::Matchers
|
12
|
-
end
|
13
|
-
rescue LoadError
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.include Mongoid::Matchers
|
14
7
|
end
|
@@ -1,47 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
OmniAuth.configure do |config|
|
15
|
-
config.test_mode = true
|
16
|
-
config.mock_auth[:facebook] = OmniAuth::MockAuthentications::Facebook.authentication
|
17
|
-
config.mock_auth[:twitter] = OmniAuth::MockAuthentications::Twitter.authentication
|
18
|
-
config.mock_auth[:ebay] = OmniAuth::MockAuthentications::Ebay.authentication
|
19
|
-
end
|
3
|
+
require 'rspeckled/mock_authentications/omniauth'
|
4
|
+
|
5
|
+
###
|
6
|
+
# Tell OmniAuth to just return whatever hash we want for each auth type
|
7
|
+
#
|
8
|
+
OmniAuth.configure do |config|
|
9
|
+
config.test_mode = true
|
10
|
+
config.mock_auth[:facebook] = OmniAuth::MockAuthentications::Facebook.authentication
|
11
|
+
config.mock_auth[:twitter] = OmniAuth::MockAuthentications::Twitter.authentication
|
12
|
+
config.mock_auth[:ebay] = OmniAuth::MockAuthentications::Ebay.authentication
|
13
|
+
end
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
15
|
+
###
|
16
|
+
# Except we don't want OmniAuth to fake anything when doing live tests
|
17
|
+
#
|
18
|
+
RSpec.configure do |config|
|
19
|
+
config.around(:each, :js => true) do |example|
|
20
|
+
previous_omniauth_test_mode = OmniAuth.config.test_mode
|
21
|
+
OmniAuth.config.test_mode = false
|
28
22
|
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
example.metadata.fetch(:mock_oauth, {}).each do |auth_type, auth_hash|
|
24
|
+
OmniAuth.config.add_mock(auth_type, auth_hash)
|
25
|
+
end
|
32
26
|
|
33
|
-
|
27
|
+
example.run
|
34
28
|
|
35
|
-
|
36
|
-
|
29
|
+
OmniAuth.config.test_mode = previous_omniauth_test_mode
|
30
|
+
end
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
32
|
+
config.before(:each, :type => :controller, :mock_oauth => lambda { |v| !!v }) do |example|
|
33
|
+
request.env['omniauth.auth'] = if example.metadata[:mock_oauth].is_a? Symbol
|
34
|
+
OmniAuth.config.mock_auth[example.metadata[:mock_oauth]]
|
35
|
+
else
|
36
|
+
OmniAuth::AuthHash.new(example.metadata[:mock_oauth])
|
37
|
+
end
|
45
38
|
end
|
46
|
-
rescue LoadError
|
47
39
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
always_permitted_parameters = %w{id}
|
3
|
+
always_permitted_parameters = %w{id}
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
5
|
+
if ActionController::Parameters.respond_to?(:always_permitted_parameters)
|
6
|
+
ActionController::Parameters.always_permitted_parameters += always_permitted_parameters
|
7
|
+
else
|
8
|
+
always_permitted_parameters.each do |always_permitted_parameter|
|
9
|
+
ActionController::Parameters::NEVER_UNPERMITTED_PARAMS << always_permitted_parameter
|
12
10
|
end
|
13
|
-
|
14
|
-
ActionController::Parameters.action_on_unpermitted_parameters = :raise
|
15
11
|
end
|
12
|
+
|
13
|
+
ActionController::Parameters.action_on_unpermitted_parameters = :raise
|
@@ -1,14 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
##############################################################################
|
6
|
-
|
7
|
-
begin
|
8
|
-
require 'recaptcha'
|
9
|
-
|
10
|
-
Recaptcha.configure do |config|
|
11
|
-
config.skip_verify_env = %w{test}
|
12
|
-
end
|
13
|
-
rescue LoadError
|
3
|
+
Recaptcha.configure do |config|
|
4
|
+
config.skip_verify_env = %w{test}
|
14
5
|
end
|
@@ -1,23 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
14
|
-
else
|
15
|
-
example.metadata[:mock_refs]
|
16
|
-
end
|
17
|
-
|
18
|
-
allow(Referehencible).to receive(:reference_number)
|
19
|
-
.and_return(reference)
|
20
|
-
end
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.before(:each, :mock_refs => lambda { |v| !!v }) do |example|
|
5
|
+
reference = if example.metadata[:mock_refs].is_a? TrueClass
|
6
|
+
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
7
|
+
else
|
8
|
+
example.metadata[:mock_refs]
|
9
|
+
end
|
10
|
+
|
11
|
+
allow(Referehencible).to receive(:reference_number)
|
12
|
+
.and_return(reference)
|
21
13
|
end
|
22
|
-
rescue LoadError
|
23
14
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
##############################################################################
|
4
|
-
# Timecop Plugin
|
5
|
-
##############################################################################
|
6
|
-
|
7
3
|
RSpec.configure do |config|
|
8
4
|
config.before(:each, :type => :controller) do
|
9
5
|
request.headers['accept'] = 'application/json'
|