rspeckled 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/rspeckled/{plugins/rails/engine.rb → patches/rails/namespaced_engine_controller_route_fix.rb} +2 -0
  4. data/lib/rspeckled/patches.rb +10 -0
  5. data/lib/rspeckled/plugins/configuration/bullet.rb +5 -0
  6. data/lib/rspeckled/plugins/configuration/capybara.rb +22 -0
  7. data/lib/rspeckled/plugins/configuration/capybara_screenshot.rb +17 -0
  8. data/lib/rspeckled/plugins/configuration/carrier_wave.rb +13 -0
  9. data/lib/rspeckled/plugins/configuration/database_cleaner.rb +7 -0
  10. data/lib/rspeckled/plugins/configuration/devise.rb +18 -0
  11. data/lib/rspeckled/plugins/{dox.rb → configuration/dox.rb} +1 -8
  12. data/lib/rspeckled/plugins/configuration/elasticsearch.rb +3 -0
  13. data/lib/rspeckled/plugins/configuration/email_spec.rb +7 -0
  14. data/lib/rspeckled/plugins/configuration/factory_bot.rb +13 -0
  15. data/lib/rspeckled/plugins/{fakeredis.rb → configuration/fakeredis.rb} +0 -0
  16. data/lib/rspeckled/plugins/{mongoid.rb → configuration/mongoid.rb} +1 -1
  17. data/lib/rspeckled/plugins/configuration/omniauth.rb +5 -0
  18. data/lib/rspeckled/plugins/{recaptcha.rb → configuration/recaptcha.rb} +1 -1
  19. data/lib/rspeckled/plugins/configuration/selenium_webdriver.rb +3 -0
  20. data/lib/rspeckled/plugins/configuration/shoulda.rb +36 -0
  21. data/lib/rspeckled/plugins/{test_after_commit.rb → configuration/sidekiq.rb} +1 -1
  22. data/lib/rspeckled/plugins/{simple_cov.rb → configuration/simple_cov.rb} +2 -2
  23. data/lib/rspeckled/plugins/configuration/test_after_commit.rb +3 -0
  24. data/lib/rspeckled/plugins/configuration/vcr.rb +26 -0
  25. data/lib/rspeckled/plugins/configuration/warden.rb +7 -0
  26. data/lib/rspeckled/plugins/configuration/webmock.rb +3 -0
  27. data/lib/rspeckled/plugins/{wisper.rb → configuration/wisper.rb} +1 -1
  28. data/lib/rspeckled/plugins/{awesome_print.rb → extensions/awesome_print.rb} +6 -6
  29. data/lib/rspeckled/plugins/extensions/capybara.rb +30 -0
  30. data/lib/rspeckled/{factories → plugins/extensions/factory_bot}/sequences.rb +4 -4
  31. data/lib/rspeckled/plugins/{faraday.rb → extensions/faraday/middleware/curl_logger.rb} +1 -3
  32. data/lib/rspeckled/plugins/extensions/faraday.rb +5 -0
  33. data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/ebay.rb +3 -1
  34. data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/facebook.rb +3 -1
  35. data/lib/rspeckled/{mock_authentications/omniauth → plugins/extensions/omniauth/mock_authentications}/twitter.rb +3 -1
  36. data/lib/rspeckled/plugins/extensions/omniauth.rb +12 -0
  37. data/lib/rspeckled/{rails → plugins/extensions/rails}/railtie.rb +3 -1
  38. data/lib/rspeckled/plugins/{garbage_collection.rb → extensions/ruby/deferred_garbage_collection.rb} +7 -15
  39. data/lib/rspeckled/{selenium → plugins/extensions/selenium}/drivers/chrome.rb +1 -1
  40. data/lib/rspeckled/{selenium → plugins/extensions/selenium}/drivers/firefox.rb +1 -1
  41. data/lib/rspeckled/plugins/extensions/strong_parameters.rb +13 -0
  42. data/lib/rspeckled/{vcr_matchers → plugins/extensions/vcr/matchers}/uri_without_trailing_id.rb +4 -12
  43. data/lib/rspeckled/plugins/extensions/vcr.rb +13 -0
  44. data/lib/rspeckled/plugins/hooks/action_mailer.rb +15 -0
  45. data/lib/rspeckled/plugins/{authentication.rb → hooks/authentication.rb} +12 -4
  46. data/lib/rspeckled/plugins/hooks/bullet.rb +22 -0
  47. data/lib/rspeckled/plugins/hooks/capybara.rb +44 -0
  48. data/lib/rspeckled/plugins/{carrier_wave.rb → hooks/carrier_wave.rb} +4 -12
  49. data/lib/rspeckled/plugins/hooks/database_cleaner.rb +37 -0
  50. data/lib/rspeckled/plugins/hooks/devise.rb +11 -0
  51. data/lib/rspeckled/plugins/hooks/dox.rb +8 -0
  52. data/lib/rspeckled/plugins/hooks/elasticsearch.rb +37 -0
  53. data/lib/rspeckled/plugins/hooks/factory_bot.rb +21 -0
  54. data/lib/rspeckled/plugins/{foreign_keys.rb → hooks/foreign_keys.rb} +10 -6
  55. data/lib/rspeckled/plugins/hooks/garbage_collection.rb +21 -0
  56. data/lib/rspeckled/plugins/hooks/referehencible.rb +18 -0
  57. data/lib/rspeckled/plugins/{request.rb → hooks/request.rb} +4 -0
  58. data/lib/rspeckled/plugins/hooks/rspec_mocks.rb +20 -0
  59. data/lib/rspeckled/plugins/hooks/selenium_webdriver.rb +15 -0
  60. data/lib/rspeckled/plugins/hooks/sidekiq.rb +49 -0
  61. data/lib/rspeckled/plugins/{singleton.rb → hooks/singletons.rb} +6 -4
  62. data/lib/rspeckled/plugins/hooks/stripe.rb +30 -0
  63. data/lib/rspeckled/plugins/{timecop.rb → hooks/timecop.rb} +11 -9
  64. data/lib/rspeckled/plugins/hooks/vcr.rb +15 -0
  65. data/lib/rspeckled/plugins/hooks/warden.rb +13 -0
  66. data/lib/rspeckled/plugins/hooks/webmock.rb +21 -0
  67. data/lib/rspeckled/plugins.rb +92 -73
  68. data/lib/rspeckled/spec_helpers/rspeckled.rb +2 -2
  69. data/lib/rspeckled/support.rb +22 -12
  70. data/lib/rspeckled/tasks/documentation.rake +2 -2
  71. data/lib/rspeckled/version.rb +1 -1
  72. data/lib/rspeckled.rb +1 -1
  73. data.tar.gz.sig +4 -3
  74. metadata +65 -44
  75. metadata.gz.sig +0 -0
  76. data/lib/rspeckled/mock_authentications/omniauth.rb +0 -3
  77. data/lib/rspeckled/plugins/bullet.rb +0 -18
  78. data/lib/rspeckled/plugins/capybara.rb +0 -127
  79. data/lib/rspeckled/plugins/database_cleaner.rb +0 -35
  80. data/lib/rspeckled/plugins/devise.rb +0 -24
  81. data/lib/rspeckled/plugins/elasticsearch.rb +0 -27
  82. data/lib/rspeckled/plugins/email.rb +0 -25
  83. data/lib/rspeckled/plugins/factory_bot.rb +0 -23
  84. data/lib/rspeckled/plugins/mocks.rb +0 -16
  85. data/lib/rspeckled/plugins/omniauth.rb +0 -39
  86. data/lib/rspeckled/plugins/rails/strong_parameters.rb +0 -13
  87. data/lib/rspeckled/plugins/referehencible.rb +0 -14
  88. data/lib/rspeckled/plugins/shoulda.rb +0 -36
  89. data/lib/rspeckled/plugins/sidekiq.rb +0 -38
  90. data/lib/rspeckled/plugins/stripe.rb +0 -26
  91. data/lib/rspeckled/plugins/vcr.rb +0 -38
  92. data/lib/rspeckled/plugins/webmock.rb +0 -19
@@ -1,24 +0,0 @@
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) && config.include(Devise::TestHelpers, :type => :controller)
8
-
9
- # Devise >= 4.2.0
10
- defined?(Devise::Test::ControllerHelpers) && config.include(Devise::Test::ControllerHelpers, :type => :controller)
11
-
12
- [:system, :feature, :request].each do |type|
13
- defined?(Devise::Test::IntegrationHelpers) && config.include(Devise::Test::IntegrationHelpers, :type => type)
14
- defined?(Warden::Test::Helpers) && config.include(Warden::Test::Helpers, :type => type)
15
-
16
- config.before(:all, :type => type) do |_example|
17
- Warden.test_mode!
18
- end
19
- end
20
-
21
- config.before(:each, :type => :controller) do |_example|
22
- @request.env['devise.mapping'] = Devise.mappings[:user]
23
- end
24
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'elasticsearch-extensions'
4
-
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
9
-
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
15
-
16
- model.__elasticsearch__.client.indices.delete :index => '_all'
17
- model.__elasticsearch__.create_index! :index => model.index_name
18
-
19
- example.run
20
-
21
- model.__elasticsearch__.client.indices.delete :index => '_all'
22
- end
23
-
24
- config.after(:suite, :elasticsearch => lambda { |v| !!v }) do
25
- Elasticsearch::Extensions::Test::Cluster.stop(:port => 9200) if Elasticsearch::Extensions::Test::Cluster.running?
26
- end
27
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # The approach to this plugin is twofold. First it uses the excellent email_spec
4
- # gem to add helpers and matchers to any spec file with :email => true set.
5
- # Secondly, it will also clear all deliveries from ActionMailer if it is loaded.
6
- #
7
- # https://github.com/bmabey/email-spec/
8
-
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
13
- end
14
-
15
- if defined? ActionMailer
16
- RSpec.configure do |config|
17
- config.before(:each, :email => true) do
18
- if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :cache
19
- mailer.clear_cache
20
- else
21
- deliveries.clear
22
- end
23
- end
24
- end
25
- end
@@ -1,23 +0,0 @@
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
-
14
- config.before(:suite) do
15
- FactoryBot.reload
16
-
17
- load 'rspeckled/factories/sequences.rb'
18
- end
19
-
20
- config.before(:each) do
21
- FactoryBot.rewind_sequences if FactoryBot.respond_to?(:rewind_sequences)
22
- end
23
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.configure do |config|
4
- config.around(:each, :verify => false) do |example|
5
- verify_partial = RSpec::Mocks.configuration.instance_variable_get(:@verify_partial_doubles)
6
- verify_constant = RSpec::Mocks.configuration.instance_variable_get(:@verify_doubled_constant_names)
7
-
8
- RSpec::Mocks.configuration.verify_partial_doubles = example.metadata[:verify]
9
- RSpec::Mocks.configuration.verify_doubled_constant_names = example.metadata[:verify]
10
-
11
- example.run
12
-
13
- RSpec::Mocks.configuration.verify_partial_doubles = verify_partial
14
- RSpec::Mocks.configuration.verify_doubled_constant_names = verify_constant
15
- end
16
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
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
14
-
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
22
-
23
- example.metadata.fetch(:mock_oauth, {}).each do |auth_type, auth_hash|
24
- OmniAuth.config.add_mock(auth_type, auth_hash)
25
- end
26
-
27
- example.run
28
-
29
- OmniAuth.config.test_mode = previous_omniauth_test_mode
30
- end
31
-
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
38
- end
39
- end
@@ -1,13 +0,0 @@
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
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
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)
13
- end
14
- end
@@ -1,36 +0,0 @@
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
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'sidekiq/testing'
4
-
5
- RSpec.configure do |config|
6
- config.before(:each, :queue => lambda { |v| !!v }) do |example|
7
- # Clears out the jobs for tests using the fake testing
8
- Sidekiq::Worker.clear_all
9
- Sidekiq::Queues.clear_all
10
-
11
- Sidekiq.redis do |client|
12
- connection = client.__send__(:instance_variable_get, :@redis) ||
13
- client.__send__(:instance_variable_get, :@client)
14
-
15
- connection.call([:flushdb])
16
- end
17
-
18
- Sidekiq.redis do |client|
19
- client.keys.each do |key|
20
- client.del(key)
21
- end
22
- end
23
-
24
- if example.metadata[:queue] == :stub
25
- Sidekiq::Testing.fake!
26
- elsif example.metadata[:queue] == :immediately_execute
27
- Sidekiq::Testing.inline!
28
- elsif [:system, :feature].include?(example.metadata[:type])
29
- Sidekiq::Testing.inline!
30
- else
31
- Sidekiq::Testing.fake!
32
- end
33
- end
34
-
35
- config.after(:each, :queue => lambda { |v| !!v }) do |_example|
36
- Sidekiq::Testing.fake!
37
- end
38
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.configure do |config|
4
- config.after(:each, :stripe => true) do
5
- if defined?(VCR)
6
- vcr_turned_on = VCR.turned_on?
7
- VCR.turn_off!
8
- end
9
-
10
- if defined?(WebMock)
11
- webmock_net_connect = WebMock.net_connect_allowed?
12
- WebMock.allow_net_connect!
13
- end
14
-
15
- begin
16
- Stripe::Plan.all(:count => 100).each do |plan|
17
- plan.delete if plan.id.match(/test/i) || plan.name.match(/test/i)
18
- end
19
-
20
- Stripe::Customer.all(:count => 100).each(&:delete)
21
- ensure
22
- VCR.turn_on! if defined?(VCR) && vcr_turned_on
23
- WebMock.allow_net_connect! if defined?(WebMock) && webmock_net_connect
24
- end
25
- end
26
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Dir[File.expand_path('../vcr_matchers/**/*.rb', __dir__)].each { |f| require f }
4
-
5
- if defined?(::WebMock)
6
- VCR.configure do |config|
7
- config.hook_into :webmock
8
- end
9
- end
10
-
11
- if defined?(::Faraday)
12
- VCR.configure do |config|
13
- config.hook_into :faraday
14
- end
15
- end
16
-
17
- RSpec.configure do |config|
18
- config.around(:each, :vcr => lambda { |v| !!v }) do |example|
19
- VCR.configuration.allow_http_connections_when_no_cassette = false
20
-
21
- example.run
22
-
23
- VCR.configuration.allow_http_connections_when_no_cassette = true
24
- end
25
- end
26
-
27
- VCR.configure do |config|
28
- config.ignore_hosts 'lvh.me', 'localhost', '127.0.0.1', '0.0.0.0' # rubocop:disable Style/IpAddresses
29
-
30
- config.cassette_library_dir = File.expand_path('./tmp/vcr_cassettes')
31
- config.allow_http_connections_when_no_cassette = true
32
-
33
- # So that the Code Climate coverage reporter (if installed) can send reports
34
- # even though VCR is enabled.
35
- config.ignore_hosts 'codeclimate.com'
36
-
37
- config.configure_rspec_metadata!
38
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'webmock/rspec'
4
-
5
- RSpec.configure do |config|
6
- config.around(:each, :webmock => lambda { |v| !!v }) do |example|
7
- options = example.metadata[:web_mock]
8
- options = case options
9
- when TrueClass
10
- { :allow_localhost => true }
11
- end
12
-
13
- WebMock.disable_net_connect!(options)
14
-
15
- example.run
16
-
17
- WebMock.allow_net_connect!
18
- end
19
- end