rspec-rails 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 293b41440231e04309edaff6ee96229fae92d409
4
- data.tar.gz: b91fd0fe65386c2ce791c93b1164201ecb8da9b5
3
+ metadata.gz: 32d2e246a1000916e4c0eeaa3e5df27115c0d253
4
+ data.tar.gz: feed9967eb41264226b18f21ca7068ae1a35bed7
5
5
  SHA512:
6
- metadata.gz: a04182629a0d1ea05441da7204b2319db54cdc1d85fa153b98c4b61cfd8c93edede9753d6ce46ef3764a52a0417ff09f4f98ffbc017f93374982985d31ff6edc
7
- data.tar.gz: ddb7206a294cc3977bd4b34f1549989a13329c80449d58740e0b3da12973771ff7d1e997fd05d7e0f4c64b144619a191928ac7a452428e0906ff5c0b6e0ced76
6
+ metadata.gz: b3d482989d7aad1d9fe4a100513bae38b38972bf45f5c165717d3bd8b6fca0b4e3522df43c3c151d099821b1677cc782c77be6d067612d52d8ca15370ceced03
7
+ data.tar.gz: e523716b7ec418eb786f638e9c91dd0f0b671bdfe20e7b3d1836b3ca5dfaf459585bbdf7ebb83d6a4fd408751e44ba1b494c7e10ac59cb988ad2d4581caf64a3
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,15 @@
1
+ ### 3.2.2 / 2015-06-03
2
+
3
+ Bug Fixes:
4
+
5
+ * Fix auto-including of generic `Helper` object for view specs sitting in the
6
+ `app/views` root (David Daniell, #1289)
7
+ * Remove pre-loading of ActionMailer in the Railtie (Aaron Kromer, #1327)
8
+ * Fix undefined method `need_auto_run=` error when using Ruby 2.1 and Rails 3.2
9
+ without the test-unit gem (Orien Madgwick, #1350)
10
+ * Fix load order issued which causes an undefined method `fixture_path` error
11
+ when loading rspec-rails after a spec has been created. (Aaron Kromer, #1372)
12
+
1
13
  ### 3.2.1 / 2015-02-23
2
14
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.2.0...v3.2.1)
3
15
 
@@ -23,28 +23,45 @@ module RSpec
23
23
  # sets the default for the `preview_path`
24
24
  initializer "rspec_rails.action_mailer",
25
25
  :before => "action_mailer.set_configs" do |app|
26
- if ::RSpec::Rails::FeatureCheck.has_action_mailer_preview?
27
- options = app.config.action_mailer
28
- # Rails 4.1 does not have `show_previews`
29
- if ::ActionMailer::Base.respond_to?(:show_previews=)
30
- options.show_previews ||= ::Rails.env.development?
31
- set_preview_path = options.show_previews
32
- else
33
- set_preview_path = ::Rails.env.development?
34
- end
35
-
36
- if set_preview_path
37
- rspec_preview_path = "#{::Rails.root}/spec/mailers/previews"
38
- config_preview_path = options.preview_path
39
- if config_preview_path.blank?
40
- options.preview_path = rspec_preview_path
41
- elsif config_preview_path != rspec_preview_path
42
- warn "Action Mailer `preview_path` is not the RSpec default. " \
43
- "Preview path is set to: #{config_preview_path}"
44
- end
45
- end
26
+ setup_preview_path(app)
27
+ end
28
+
29
+ private
30
+
31
+ def setup_preview_path(app)
32
+ # If the action mailer railtie isn't loaded the config will not respond
33
+ return unless supports_action_mailer_previews?(app.config)
34
+ options = app.config.action_mailer
35
+ config_default_preview_path(options) if config_preview_path?(options)
36
+ end
37
+
38
+ def config_preview_path?(options)
39
+ # This string version check avoids loading the ActionMailer class, as
40
+ # would happen using `defined?`. This is necessary because the
41
+ # ActionMailer class only loads it's settings once, at load time. If we
42
+ # load the class now any settings declared in a config block in an
43
+ # initializer will be ignored.
44
+ #
45
+ # We cannot use `respond_to?(:show_previews)` here as it will always
46
+ # return `true`.
47
+ if ::Rails::VERSION::STRING < '4.2'
48
+ ::Rails.env.development?
49
+ elsif options.show_previews.nil?
50
+ options.show_previews = ::Rails.env.development?
51
+ else
52
+ options.show_previews
46
53
  end
47
54
  end
55
+
56
+ def config_default_preview_path(options)
57
+ return unless options.preview_path.blank?
58
+ options.preview_path = "#{::Rails.root}/spec/mailers/previews"
59
+ end
60
+
61
+ def supports_action_mailer_previews?(config)
62
+ config.respond_to?(:action_mailer) &&
63
+ config.action_mailer.respond_to?(:preview_path)
64
+ end
48
65
  end
49
66
  end
50
67
  end
@@ -5,6 +5,19 @@ require 'active_support/core_ext/string'
5
5
 
6
6
  module RSpec
7
7
  module Rails
8
+ def self.disable_testunit_autorun
9
+ # `Test::Unit::AutoRunner.need_auto_run=` was introduced to the test-unit
10
+ # gem in version 2.4.9. Previous to this version `Test::Unit.run=` was
11
+ # used. The implementation of test-unit included with Ruby has neither
12
+ # method.
13
+ if defined?(Test::Unit::AutoRunner.need_auto_run = ())
14
+ Test::Unit::AutoRunner.need_auto_run = false
15
+ elsif defined?(Test::Unit.run = ())
16
+ Test::Unit.run = false
17
+ end
18
+ end
19
+ private_class_method :disable_testunit_autorun
20
+
8
21
  if ::Rails::VERSION::STRING >= '4.1.0'
9
22
  if defined?(Kernel.gem)
10
23
  gem 'minitest'
@@ -37,7 +50,7 @@ module RSpec
37
50
  # date). If so, we turn the auto runner off.
38
51
  require 'test/unit'
39
52
  require 'test/unit/assertions'
40
- Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
53
+ disable_testunit_autorun
41
54
  rescue LoadError => e
42
55
  raise LoadError, <<-ERR.squish, e.backtrace
43
56
  Ruby 2.2+ has removed test/unit from the core library. Rails
@@ -62,7 +75,7 @@ module RSpec
62
75
  require 'test/unit/assertions'
63
76
  end
64
77
  # Turn off test unit's auto runner for those using the gem
65
- Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
78
+ disable_testunit_autorun
66
79
  # Constant aliased to either Minitest or TestUnit, depending on what is
67
80
  # loaded.
68
81
  Assertions = Test::Unit::Assertions
@@ -56,12 +56,21 @@ module RSpec
56
56
  config.add_setting :infer_base_class_for_anonymous_controllers, :default => true
57
57
 
58
58
  # fixture support
59
- config.include RSpec::Rails::FixtureSupport
60
59
  config.add_setting :use_transactional_fixtures, :alias_with => :use_transactional_examples
61
60
  config.add_setting :use_instantiated_fixtures
62
61
  config.add_setting :global_fixtures
63
62
  config.add_setting :fixture_path
64
63
 
64
+ # TODO: We'll need to create a deprecated module in order to properly
65
+ # report to gems / projects which are relying on this being loaded
66
+ # globally.
67
+ #
68
+ # See rspec/rspec-rails#1355 for history
69
+ #
70
+ # @deprecated Include `RSpec::Rails::RailsExampleGroup` or
71
+ # `RSpec::Rails::FixtureSupport` directly instead
72
+ config.include RSpec::Rails::FixtureSupport
73
+
65
74
  # This allows us to expose `render_views` as a config option even though it
66
75
  # breaks the convention of other options by using `render_views` as a
67
76
  # command (i.e. `render_views = true`), where it would normally be used
@@ -14,7 +14,7 @@ module RSpec
14
14
  module ClassMethods
15
15
  def _default_helper
16
16
  base = metadata[:description].split('/')[0..-2].join('/')
17
- (base.camelize + 'Helper').constantize if base
17
+ (base.camelize + 'Helper').constantize unless base.to_s.empty?
18
18
  rescue NameError
19
19
  nil
20
20
  end
@@ -38,6 +38,11 @@ module RSpec
38
38
  has_action_mailer? && defined?(::ActionMailer::Preview)
39
39
  end
40
40
 
41
+ def has_action_mailer_show_preview?
42
+ has_action_mailer_preview? &&
43
+ ::ActionMailer::Base.respond_to?(:show_previews=)
44
+ end
45
+
41
46
  def has_1_9_hash_syntax?
42
47
  ::Rails::VERSION::STRING > '4.0'
43
48
  end
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Rails.
4
4
  module Version
5
5
  # Current version of RSpec Rails, in semantic versioning format.
6
- STRING = '3.2.1'
6
+ STRING = '3.2.2'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -44,7 +44,7 @@ cert_chain:
44
44
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
45
45
  F3MdtaDehhjC
46
46
  -----END CERTIFICATE-----
47
- date: 2015-02-24 00:00:00.000000000 Z
47
+ date: 2015-06-03 00:00:00.000000000 Z
48
48
  dependencies:
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: activesupport
@@ -316,9 +316,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  version: '0'
317
317
  requirements: []
318
318
  rubyforge_project: rspec
319
- rubygems_version: 2.4.5
319
+ rubygems_version: 2.2.2
320
320
  signing_key:
321
321
  specification_version: 4
322
- summary: rspec-rails-3.2.1
322
+ summary: rspec-rails-3.2.2
323
323
  test_files: []
324
324
  has_rdoc:
metadata.gz.sig CHANGED
Binary file