rspeckled 1.0.3 → 1.0.4
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/{plugins/rails/engine.rb → patches/rails/namespaced_engine_controller_route_fix.rb} +2 -0
- data/lib/rspeckled/patches.rb +10 -0
- data/lib/rspeckled/plugins/configuration/bullet.rb +5 -0
- data/lib/rspeckled/plugins/configuration/capybara.rb +22 -0
- data/lib/rspeckled/plugins/configuration/capybara_screenshot.rb +17 -0
- data/lib/rspeckled/plugins/configuration/carrier_wave.rb +13 -0
- data/lib/rspeckled/plugins/configuration/database_cleaner.rb +7 -0
- data/lib/rspeckled/plugins/configuration/devise.rb +18 -0
- data/lib/rspeckled/plugins/{dox.rb → configuration/dox.rb} +1 -8
- data/lib/rspeckled/plugins/configuration/elasticsearch.rb +3 -0
- data/lib/rspeckled/plugins/configuration/email_spec.rb +7 -0
- data/lib/rspeckled/plugins/configuration/factory_bot.rb +13 -0
- data/lib/rspeckled/plugins/{fakeredis.rb → configuration/fakeredis.rb} +0 -0
- data/lib/rspeckled/plugins/{mongoid.rb → configuration/mongoid.rb} +1 -1
- data/lib/rspeckled/plugins/configuration/omniauth.rb +5 -0
- data/lib/rspeckled/plugins/{recaptcha.rb → configuration/recaptcha.rb} +1 -1
- data/lib/rspeckled/plugins/configuration/selenium_webdriver.rb +3 -0
- data/lib/rspeckled/plugins/configuration/shoulda.rb +36 -0
- data/lib/rspeckled/plugins/{test_after_commit.rb → configuration/sidekiq.rb} +1 -1
- data/lib/rspeckled/plugins/{simple_cov.rb → configuration/simple_cov.rb} +2 -2
- data/lib/rspeckled/plugins/configuration/test_after_commit.rb +3 -0
- data/lib/rspeckled/plugins/configuration/vcr.rb +26 -0
- data/lib/rspeckled/plugins/configuration/warden.rb +7 -0
- data/lib/rspeckled/plugins/configuration/webmock.rb +3 -0
- data/lib/rspeckled/plugins/{wisper.rb → configuration/wisper.rb} +1 -1
- data/lib/rspeckled/plugins/{awesome_print.rb → extensions/awesome_print.rb} +6 -6
- data/lib/rspeckled/plugins/extensions/capybara.rb +30 -0
- data/lib/rspeckled/{factories → plugins/extensions/factory_bot}/sequences.rb +4 -4
- data/lib/rspeckled/plugins/{faraday.rb → extensions/faraday/middleware/curl_logger.rb} +1 -3
- data/lib/rspeckled/plugins/extensions/faraday.rb +5 -0
- data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/ebay.rb +3 -1
- data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/facebook.rb +3 -1
- data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/twitter.rb +3 -1
- data/lib/rspeckled/plugins/extensions/omniauth.rb +12 -0
- data/lib/rspeckled/{rails → plugins/extensions/rails}/railtie.rb +3 -1
- data/lib/rspeckled/plugins/{garbage_collection.rb → extensions/ruby/deferred_garbage_collection.rb} +7 -15
- data/lib/rspeckled/{selenium → plugins/extensions/selenium}/drivers/chrome.rb +1 -1
- data/lib/rspeckled/{selenium → plugins/extensions/selenium}/drivers/firefox.rb +1 -1
- data/lib/rspeckled/plugins/extensions/strong_parameters.rb +13 -0
- data/lib/rspeckled/{vcr_matchers → plugins/extensions/vcr/matchers}/uri_without_trailing_id.rb +4 -12
- data/lib/rspeckled/plugins/extensions/vcr.rb +13 -0
- data/lib/rspeckled/plugins/hooks/action_mailer.rb +15 -0
- data/lib/rspeckled/plugins/{authentication.rb → hooks/authentication.rb} +12 -4
- data/lib/rspeckled/plugins/hooks/bullet.rb +22 -0
- data/lib/rspeckled/plugins/hooks/capybara.rb +44 -0
- data/lib/rspeckled/plugins/{carrier_wave.rb → hooks/carrier_wave.rb} +4 -12
- data/lib/rspeckled/plugins/hooks/database_cleaner.rb +37 -0
- data/lib/rspeckled/plugins/hooks/devise.rb +11 -0
- data/lib/rspeckled/plugins/hooks/dox.rb +8 -0
- data/lib/rspeckled/plugins/hooks/elasticsearch.rb +37 -0
- data/lib/rspeckled/plugins/hooks/factory_bot.rb +21 -0
- data/lib/rspeckled/plugins/{foreign_keys.rb → hooks/foreign_keys.rb} +10 -6
- data/lib/rspeckled/plugins/hooks/garbage_collection.rb +21 -0
- data/lib/rspeckled/plugins/hooks/referehencible.rb +18 -0
- data/lib/rspeckled/plugins/{request.rb → hooks/request.rb} +4 -0
- data/lib/rspeckled/plugins/hooks/rspec_mocks.rb +20 -0
- data/lib/rspeckled/plugins/hooks/selenium_webdriver.rb +15 -0
- data/lib/rspeckled/plugins/hooks/sidekiq.rb +49 -0
- data/lib/rspeckled/plugins/{singleton.rb → hooks/singletons.rb} +6 -4
- data/lib/rspeckled/plugins/hooks/stripe.rb +30 -0
- data/lib/rspeckled/plugins/{timecop.rb → hooks/timecop.rb} +11 -9
- data/lib/rspeckled/plugins/hooks/vcr.rb +15 -0
- data/lib/rspeckled/plugins/hooks/warden.rb +13 -0
- data/lib/rspeckled/plugins/hooks/webmock.rb +21 -0
- data/lib/rspeckled/plugins.rb +92 -73
- data/lib/rspeckled/spec_helpers/rspeckled.rb +2 -2
- data/lib/rspeckled/support.rb +22 -12
- data/lib/rspeckled/tasks/documentation.rake +2 -2
- data/lib/rspeckled/version.rb +1 -1
- data/lib/rspeckled.rb +1 -1
- data.tar.gz.sig +4 -3
- metadata +65 -44
- metadata.gz.sig +0 -0
- data/lib/rspeckled/mock_authentications/omniauth.rb +0 -3
- data/lib/rspeckled/plugins/bullet.rb +0 -18
- data/lib/rspeckled/plugins/capybara.rb +0 -127
- data/lib/rspeckled/plugins/database_cleaner.rb +0 -35
- data/lib/rspeckled/plugins/devise.rb +0 -24
- data/lib/rspeckled/plugins/elasticsearch.rb +0 -27
- data/lib/rspeckled/plugins/email.rb +0 -25
- data/lib/rspeckled/plugins/factory_bot.rb +0 -23
- data/lib/rspeckled/plugins/mocks.rb +0 -16
- data/lib/rspeckled/plugins/omniauth.rb +0 -39
- data/lib/rspeckled/plugins/rails/strong_parameters.rb +0 -13
- data/lib/rspeckled/plugins/referehencible.rb +0 -14
- data/lib/rspeckled/plugins/shoulda.rb +0 -36
- data/lib/rspeckled/plugins/sidekiq.rb +0 -38
- data/lib/rspeckled/plugins/stripe.rb +0 -26
- data/lib/rspeckled/plugins/vcr.rb +0 -38
- data/lib/rspeckled/plugins/webmock.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35cfc4869754da6b4ae40c571a7ec1584f4fe931a04f5ec6d7b9d214d339520f
|
4
|
+
data.tar.gz: a5d0f27dd70606c2e368893ff66267457f0e3b25c700706cabaeca0839cbc071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6701f8410b5234d3a9d5d4546783c5beef2164236363b0bd0a9726e272c64f55fc32aed074d120e6c8e09a3326ec97952b4717fa3c62fa91e7edc67f660caf47
|
7
|
+
data.tar.gz: 7529faf6a2efd92e0de4427552e30cba340197e738aee6e29936ef68b5f8c1ab8aa8abf55b4744cfccca4eebc313e7f7d78ef6748c099259f69bdca817c74f71
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Rspeckled
|
4
|
+
module Rails
|
4
5
|
module NamespacedEngineControllerRouteFix
|
5
6
|
def self.included(base)
|
6
7
|
engine_name = Dir.pwd.split('/').last.camelize
|
@@ -10,3 +11,4 @@ module NamespacedEngineControllerRouteFix
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
14
|
+
end
|
data/lib/rspeckled/patches.rb
CHANGED
@@ -4,3 +4,13 @@ begin
|
|
4
4
|
require 'dirty_url/patches/feature_example_group'
|
5
5
|
rescue LoadError
|
6
6
|
end
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
if defined?(::RSpec::Rails)
|
10
|
+
if ::Pathname.pwd.join('spec', 'dummy', 'config', 'environment.rb').exist?
|
11
|
+
require 'rspeckled/patches/rails/namespaced_engine_controller_route_fix'
|
12
|
+
|
13
|
+
config.include Rspeckled::NamespacedEngineControllerRouteFix, :type => :controller
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capybara/rspec'
|
4
|
+
require 'capybara/rails' if defined?(::Rails)
|
5
|
+
|
6
|
+
# Configure Capybara
|
7
|
+
|
8
|
+
::Capybara.configure do |config|
|
9
|
+
config.exact = true
|
10
|
+
config.match = :one
|
11
|
+
config.ignore_hidden_elements = true
|
12
|
+
config.visible_text_only = true
|
13
|
+
end
|
14
|
+
|
15
|
+
::Capybara.save_path = "#{::Dir.pwd}/tmp/screenshots"
|
16
|
+
|
17
|
+
if defined?(::Chamber)
|
18
|
+
::Capybara.default_host = ::Chamber.env.http.base_url
|
19
|
+
::Capybara.app_host = ::Chamber.env.http.base_url
|
20
|
+
::Capybara.asset_host = ::Chamber.env.http.base_url
|
21
|
+
::Capybara.server_port = ::Chamber.env.http.url_components.port
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'capybara-screenshot/rspec'
|
4
|
+
|
5
|
+
::Capybara::Screenshot.autosave_on_failure = true
|
6
|
+
::Capybara::Screenshot.prune_strategy = :keep_last_run
|
7
|
+
|
8
|
+
::Capybara::Screenshot::RSpec.add_link_to_screenshot_for_failed_examples = false
|
9
|
+
|
10
|
+
::Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
|
11
|
+
example.full_description.downcase.tr(' ', '-').gsub(%r{^.*/spec/}, '')
|
12
|
+
end
|
13
|
+
|
14
|
+
::Capybara::Screenshot.register_driver(:chrome) { |driver, path| driver.browser.save_screenshot(path) }
|
15
|
+
::Capybara::Screenshot.register_driver(:headless_chrome) { |driver, path| driver.browser.save_screenshot(path) }
|
16
|
+
::Capybara::Screenshot.register_driver(:firefox) { |driver, path| driver.browser.save_screenshot(path) }
|
17
|
+
::Capybara::Screenshot.register_driver(:headless_firefox) { |driver, path| driver.browser.save_screenshot(path) }
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'carrierwave/test/matchers'
|
4
|
+
|
5
|
+
::CarrierWave.configure do |config|
|
6
|
+
config.storage = :file
|
7
|
+
config.root = ::File.expand_path('./tmp/attachments')
|
8
|
+
config.enable_processing = false
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include ::CarrierWave::Test::Matchers, :file_attachment => true
|
13
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::Devise.stretches = 1
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# ::Devise < 4.2.0
|
7
|
+
defined?(::Devise::TestHelpers) &&
|
8
|
+
config.include(::Devise::TestHelpers, :type => :controller)
|
9
|
+
|
10
|
+
# ::Devise >= 4.2.0
|
11
|
+
defined?(::Devise::Test::ControllerHelpers) &&
|
12
|
+
config.include(::Devise::Test::ControllerHelpers, :type => :controller)
|
13
|
+
|
14
|
+
[:system, :feature, :request].each do |type|
|
15
|
+
defined?(::Devise::Test::IntegrationHelpers) &&
|
16
|
+
config.include(::Devise::Test::IntegrationHelpers, :type => type)
|
17
|
+
end
|
18
|
+
end
|
@@ -2,13 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'pathname'
|
4
4
|
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.after(:each, :dox) do |example|
|
7
|
-
example.metadata[:request] = request
|
8
|
-
example.metadata[:response] = response
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
5
|
begin
|
13
6
|
require 'dox'
|
14
7
|
|
@@ -21,7 +14,7 @@ begin
|
|
21
14
|
|
22
15
|
api_docs_folder.glob('**/*.rb').each { |f| require f }
|
23
16
|
|
24
|
-
titleized_application_name = Rails
|
17
|
+
titleized_application_name = ::Rails
|
25
18
|
.application
|
26
19
|
.class
|
27
20
|
.name
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
::FactoryBot.definition_file_paths << './spec/factories'
|
4
|
+
|
5
|
+
if ::FactoryBot.configuration.factories.count.zero? &&
|
6
|
+
::Rails.application.class.name.match(/Dummy/)
|
7
|
+
|
8
|
+
::FactoryBot.find_definitions
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include ::FactoryBot::Syntax::Methods
|
13
|
+
end
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.include(::Shoulda::Matchers::ActiveModel, :type => :model)
|
5
|
+
config.include(::Shoulda::Matchers::ActiveRecord, :type => :model)
|
6
|
+
end
|
7
|
+
|
8
|
+
::Shoulda::Matchers.configure do |config|
|
9
|
+
config.integrate do |with|
|
10
|
+
with.test_framework :rspec
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined?(::ActiveRecord)
|
15
|
+
::Shoulda::Matchers.configure do |config|
|
16
|
+
config.integrate do |with|
|
17
|
+
with.library :active_record
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if defined?(::ActiveModel)
|
23
|
+
::Shoulda::Matchers.configure do |config|
|
24
|
+
config.integrate do |with|
|
25
|
+
with.library :active_model
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if defined?(::ActionController)
|
31
|
+
::Shoulda::Matchers.configure do |config|
|
32
|
+
config.integrate do |with|
|
33
|
+
with.library :action_controller
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -7,10 +7,10 @@ begin
|
|
7
7
|
if ENV['CIRCLE_ARTIFACTS']
|
8
8
|
coverage_directory = File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')
|
9
9
|
|
10
|
-
SimpleCov.coverage_dir(coverage_directory)
|
10
|
+
::SimpleCov.coverage_dir(coverage_directory)
|
11
11
|
end
|
12
12
|
|
13
|
-
SimpleCov.start do
|
13
|
+
::SimpleCov.start do
|
14
14
|
add_filter '/config/'
|
15
15
|
add_filter '/spec/'
|
16
16
|
add_filter '/test/'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if defined?(::WebMock)
|
4
|
+
::VCR.configure do |config|
|
5
|
+
config.hook_into :webmock
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
if defined?(::Faraday)
|
10
|
+
::VCR.configure do |config|
|
11
|
+
config.hook_into :faraday
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
::VCR.configure do |config|
|
16
|
+
config.ignore_hosts 'lvh.me', 'localhost', '127.0.0.1', '0.0.0.0' # rubocop:disable Style/IpAddresses
|
17
|
+
|
18
|
+
# So that the Code Climate coverage reporter (if installed) can send reports
|
19
|
+
# even though VCR is enabled.
|
20
|
+
config.ignore_hosts 'codeclimate.com'
|
21
|
+
|
22
|
+
config.cassette_library_dir = ::File.expand_path('./tmp/vcr_cassettes')
|
23
|
+
config.allow_http_connections_when_no_cassette = true
|
24
|
+
|
25
|
+
config.configure_rspec_metadata!
|
26
|
+
end
|
@@ -7,19 +7,19 @@ require 'io/console'
|
|
7
7
|
|
8
8
|
module Kernel
|
9
9
|
def sap(*messages)
|
10
|
-
columns = if IO.console
|
11
|
-
IO.console.winsize[1]
|
10
|
+
columns = if ::IO.console
|
11
|
+
::IO.console.winsize[1]
|
12
12
|
else
|
13
13
|
80
|
14
14
|
end
|
15
15
|
|
16
16
|
puts
|
17
17
|
print "\e[1;35m"
|
18
|
-
print " #{Time.now} ".center(columns, '*')
|
18
|
+
print " #{::Time.now} ".center(columns, '*')
|
19
19
|
print "\e[0m\n"
|
20
20
|
puts
|
21
|
-
root_path = if defined?(Rails)
|
22
|
-
Rails.root.to_s
|
21
|
+
root_path = if defined?(::Rails)
|
22
|
+
::Rails.root.to_s
|
23
23
|
else
|
24
24
|
`git rev-parse --show-toplevel`
|
25
25
|
end
|
@@ -72,7 +72,7 @@ module Kernel
|
|
72
72
|
print message.to_str
|
73
73
|
print "\e[0m\n"
|
74
74
|
puts
|
75
|
-
elsif message.respond_to?(:read)
|
75
|
+
elsif message.respond_to?(:read) && message.method(:read).arity == 1
|
76
76
|
# Naive Check for Binary Data
|
77
77
|
# https://www.ruby-forum.com/topic/122170
|
78
78
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspeckled/plugins/extensions/selenium/drivers/chrome'
|
4
|
+
require 'rspeckled/plugins/extensions/selenium/drivers/firefox'
|
5
|
+
|
6
|
+
# Configure Server
|
7
|
+
|
8
|
+
::Capybara.register_server :puma do |app, _port, _host|
|
9
|
+
require 'rack/handler/puma'
|
10
|
+
|
11
|
+
host = (defined?(::Chamber) && ::Chamber.env.http.url_components.host) || ENV['HOST'] || 'lvh.me'
|
12
|
+
port = (defined?(::Chamber) && ::Chamber.env.http.url_components.port) || ENV['PORT'] || '3000'
|
13
|
+
|
14
|
+
::Rack::Handler::Puma.run(app, :Host => host, :Port => port, :Threads => '0:1', :Silent => true)
|
15
|
+
end
|
16
|
+
|
17
|
+
::Capybara.server = :puma
|
18
|
+
|
19
|
+
# Configure Browser Drivers
|
20
|
+
|
21
|
+
downloads_directory = "#{Dir.pwd}/tmp/downloads/"
|
22
|
+
chrome_driver = ::Rspeckled::Selenium::Drivers::Chrome.new(:downloads_directory => downloads_directory)
|
23
|
+
firefox_driver = ::Rspeckled::Selenium::Drivers::Firefox.new(:downloads_directory => downloads_directory)
|
24
|
+
|
25
|
+
::Capybara.register_driver(:chrome) { |app| chrome_driver.driver(app) }
|
26
|
+
::Capybara.register_driver(:headless_chrome) { |app| chrome_driver.headless(app) }
|
27
|
+
::Capybara.register_driver(:firefox) { |app| firefox_driver.driver(app) }
|
28
|
+
::Capybara.register_driver(:headless_firefox) { |app| firefox_driver.headless(app) }
|
29
|
+
|
30
|
+
::Capybara.javascript_driver = :headless_chrome
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
FactoryBot.define do
|
3
|
+
::FactoryBot.define do
|
4
4
|
sequence(:uuid) do |_n|
|
5
|
-
SecureRandom.uuid
|
5
|
+
::SecureRandom.uuid
|
6
6
|
end
|
7
7
|
|
8
8
|
sequence(:email) do |n|
|
@@ -14,10 +14,10 @@ FactoryBot.define do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
sequence(:token) do
|
17
|
-
SecureRandom.hex(16)
|
17
|
+
::SecureRandom.hex(16)
|
18
18
|
end
|
19
19
|
|
20
20
|
sequence(:auth_token) do
|
21
|
-
Base64.strict_encode64(SecureRandom.hex(32))
|
21
|
+
::Base64.strict_encode64(::SecureRandom.hex(32))
|
22
22
|
end
|
23
23
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Rspeckled
|
4
4
|
module Faraday
|
5
5
|
module Middleware
|
6
|
-
class
|
6
|
+
class CurlLogger < ::Faraday::Response::Middleware
|
7
7
|
def self.default_logger
|
8
8
|
require 'logger'
|
9
9
|
|
@@ -53,5 +53,3 @@ end
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
57
|
-
::Faraday::Response.register_middleware(:detailed_logger => Rspeckled::Faraday::Middleware::DetailedLogger)
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Rspeckled
|
3
4
|
module OmniAuth
|
4
5
|
module MockAuthentications
|
5
6
|
module Ebay
|
6
7
|
def self.authentication
|
7
|
-
OmniAuth::AuthHash.new(
|
8
|
+
::OmniAuth::AuthHash.new(
|
8
9
|
'provider' => 'ebay',
|
9
10
|
'uid' => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
|
10
11
|
'info' =>
|
@@ -24,3 +25,4 @@ module Ebay
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
28
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Rspeckled
|
3
4
|
module OmniAuth
|
4
5
|
module MockAuthentications
|
5
6
|
module Facebook
|
6
7
|
def self.authentication
|
7
|
-
OmniAuth::AuthHash.new(
|
8
|
+
::OmniAuth::AuthHash.new(
|
8
9
|
'provider' => 'facebook',
|
9
10
|
'uid' => '100002971692646',
|
10
11
|
'credentials' => {
|
@@ -43,3 +44,4 @@ module Facebook
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
47
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Rspeckled
|
3
4
|
module OmniAuth
|
4
5
|
module MockAuthentications
|
5
6
|
module Twitter
|
6
7
|
def self.authentication
|
7
|
-
OmniAuth::AuthHash.new(
|
8
|
+
::OmniAuth::AuthHash.new(
|
8
9
|
'provider' => 'twitter',
|
9
10
|
'uid' => '100002971692646',
|
10
11
|
'credentials' => {
|
@@ -43,3 +44,4 @@ module Twitter
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
47
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspeckled/plugins/extensions/omniauth/mock_authentications/ebay'
|
4
|
+
require 'rspeckled/plugins/extensions/omniauth/mock_authentications/facebook'
|
5
|
+
require 'rspeckled/plugins/extensions/omniauth/mock_authentications/twitter'
|
6
|
+
|
7
|
+
::OmniAuth.configure do |config|
|
8
|
+
# Setup Mocks for Common Services
|
9
|
+
config.mock_auth[:facebook] = ::Rspeckled::OmniAuth::MockAuthentications::Facebook.authentication
|
10
|
+
config.mock_auth[:twitter] = ::Rspeckled::OmniAuth::MockAuthentications::Twitter.authentication
|
11
|
+
config.mock_auth[:ebay] = ::Rspeckled::OmniAuth::MockAuthentications::Ebay.authentication
|
12
|
+
end
|
data/lib/rspeckled/plugins/{garbage_collection.rb → extensions/ruby/deferred_garbage_collection.rb}
RENAMED
@@ -4,6 +4,7 @@
|
|
4
4
|
# Shamelessly stolen from http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection/
|
5
5
|
#
|
6
6
|
module Rspeckled
|
7
|
+
module Ruby
|
7
8
|
class DeferredGarbageCollection
|
8
9
|
THRESHOLD = (ENV['DEFER_GC'] || 20.0).to_f
|
9
10
|
|
@@ -18,13 +19,13 @@ class DeferredGarbageCollection
|
|
18
19
|
|
19
20
|
cycle_garbage_collector
|
20
21
|
|
21
|
-
self.garbage_last_collected_at = Time.now
|
22
|
+
self.garbage_last_collected_at = ::Time.now
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.cycle_garbage_collector
|
25
|
-
GC.enable
|
26
|
-
GC.start
|
27
|
-
GC.disable
|
26
|
+
::GC.enable
|
27
|
+
::GC.start
|
28
|
+
::GC.disable
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.over_deferrment_threshold?
|
@@ -36,11 +37,11 @@ class DeferredGarbageCollection
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.time_since_garbage_last_collected
|
39
|
-
Time.now - garbage_last_collected_at
|
40
|
+
::Time.now - garbage_last_collected_at
|
40
41
|
end
|
41
42
|
|
42
43
|
def self.garbage_last_collected_at
|
43
|
-
@garbage_last_collected_at || Time.now
|
44
|
+
@garbage_last_collected_at || ::Time.now
|
44
45
|
end
|
45
46
|
|
46
47
|
class << self
|
@@ -48,13 +49,4 @@ class DeferredGarbageCollection
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
end
|
51
|
-
|
52
|
-
RSpec.configure do |config|
|
53
|
-
config.before(:all) do
|
54
|
-
Rspeckled::DeferredGarbageCollection.start
|
55
|
-
end
|
56
|
-
|
57
|
-
config.after(:all) do
|
58
|
-
Rspeckled::DeferredGarbageCollection.reconsider
|
59
|
-
end
|
60
52
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
always_permitted_parameters = %w{id}
|
4
|
+
|
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
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
::ActionController::Parameters.action_on_unpermitted_parameters = :raise
|
data/lib/rspeckled/{vcr_matchers → plugins/extensions/vcr/matchers}/uri_without_trailing_id.rb
RENAMED
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Rspeckled
|
4
|
-
module
|
4
|
+
module Vcr
|
5
|
+
module Matchers
|
5
6
|
class UriWithoutTrailingId
|
6
7
|
attr_accessor :trailing_id_matcher
|
7
8
|
|
@@ -14,8 +15,8 @@ class UriWithoutTrailingId
|
|
14
15
|
vcr_cassette_request_uri = vcr_cassette_request.uri
|
15
16
|
|
16
17
|
if request_uri.match?(trailing_id_matcher)
|
17
|
-
request_uri_without_id = request_uri.sub
|
18
|
-
vcr_cassette_request_uri_without_id = vcr_cassette_request_uri.sub
|
18
|
+
request_uri_without_id = request_uri.sub(trailing_id_matcher, '')
|
19
|
+
vcr_cassette_request_uri_without_id = vcr_cassette_request_uri.sub(trailing_id_matcher, '')
|
19
20
|
|
20
21
|
request_uri.match(trailing_id_matcher) &&
|
21
22
|
vcr_cassette_request_uri.match(trailing_id_matcher) &&
|
@@ -27,13 +28,4 @@ class UriWithoutTrailingId
|
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
30
|
-
|
31
|
-
VCR.configure do |config|
|
32
|
-
config.register_request_matcher :uri_without_trailing_guid do |request, vcr_cassette_request|
|
33
|
-
Rspeckled::VcrMatchers::UriWithoutTrailingId.new(%r(/[a-f0-9\-]{32,36}/?\z)).call(request, vcr_cassette_request)
|
34
|
-
end
|
35
|
-
|
36
|
-
config.register_request_matcher :uri_without_trailing_id do |request, vcr_cassette_request|
|
37
|
-
Rspeckled::VcrMatchers::UriWithoutTrailingId.new(%r{/\d+/?\z}).call(request, vcr_cassette_request)
|
38
|
-
end
|
39
31
|
end
|