rspec-activemodel-mocks 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61067a6e3659e0dfa6075752a906401406b81e19
4
- data.tar.gz: c0c70c6a9ac57386cd03166883e753e0a09ea1b0
3
+ metadata.gz: fe8e05d703a22aa1fc278645068aae3818e01f8f
4
+ data.tar.gz: b9d7e9d0353224e2307f90c20e89a78d9656ac87
5
5
  SHA512:
6
- metadata.gz: 88ec5084ef52d15c87c7bea32e5fca84e54c64225a270759f60cf01a15d0711e7a48761901d36fa0eefb6c2d8769959103228d8796dd253db3f8a5f45ef9ac2e
7
- data.tar.gz: 5a54c58d712524c538033df023bbacca83f280e9e471451912086b19e4cf0becdefe2aa03c890e04d8ad54ddfbf36cb9189f22cb286a40424fe613fe953e275c
6
+ metadata.gz: 1318ccf14e3acac642963c468e9e6fa768a0ccf74422ce6ec8d5435527d69e6ca981abfac7e1691d771d248b74488d1e66142a6a0d7eed215d1b6459c7e61908
7
+ data.tar.gz: b945ac6c0075e1df095388983d08e823ba15518e6f7bcf1d8ae03d3ba4635d49a373d001e85d069ff22d6ea53d68e759ca744a060c51ae440656ab096789172f
@@ -52,6 +52,10 @@ module RSpec::ActiveModel::Mocks
52
52
  send(key)
53
53
  end
54
54
 
55
+ # Rails>4.2 uses _read_attribute internally, as an optimized
56
+ # alternative to record['id']
57
+ alias_method :_read_attribute, :[]
58
+
55
59
  # Returns the opposite of `persisted?`
56
60
  def new_record?
57
61
  !persisted?
@@ -2,7 +2,7 @@ module RSpec
2
2
  module ActiveModel
3
3
  module Mocks
4
4
  module Version
5
- STRING = '1.0.1'
5
+ STRING = '1.0.2'
6
6
  end
7
7
  end
8
8
  end
@@ -414,8 +414,55 @@ describe "mock_model(RealModel)" do
414
414
  include Minitest::Assertions
415
415
  include MinitestAssertion
416
416
  rescue LoadError
417
- require 'test/unit/assertions'
418
- include Test::Unit::Assertions
417
+ if RUBY_VERSION >= '2.2.0'
418
+ # Minitest / TestUnit has been removed from ruby core. However, we are
419
+ # on an old Rails version and must load the appropriate gem
420
+ version = ENV.fetch('RAILS_VERSION', '4.2.4')
421
+ if version >= '4.0.0'
422
+ # ActiveSupport 4.0.x has the minitest '~> 4.2' gem as a dependency
423
+ # This gem has no `lib/minitest.rb` file.
424
+ gem 'minitest' if defined?(Kernel.gem)
425
+ require 'minitest/unit'
426
+ include MiniTest::Assertions
427
+ elsif version >= '3.2.22' || version == '3-2-stable'
428
+ begin
429
+ # Test::Unit "helpfully" sets up autoload for its `AutoRunner`.
430
+ # While we do not reference it directly, when we load the `TestCase`
431
+ # classes from AS (ActiveSupport), AS kindly references `AutoRunner`
432
+ # for everyone.
433
+ #
434
+ # To handle this we need to pre-emptively load 'test/unit' and make
435
+ # sure the version installed has `AutoRunner` (the 3.x line does to
436
+ # date). If so, we turn the auto runner off.
437
+ require 'test/unit'
438
+ require 'test/unit/assertions'
439
+ rescue LoadError => e
440
+ raise LoadError, <<-ERR.squeeze, e.backtrace
441
+ Ruby 2.2+ has removed test/unit from the core library. Rails
442
+ requires this as a dependency. Please add test-unit gem to your
443
+ Gemfile: `gem 'test-unit', '~> 3.0'` (#{e.message})"
444
+ ERR
445
+ end
446
+ include Test::Unit::Assertions
447
+ if defined?(Test::Unit::AutoRunner.need_auto_run = ())
448
+ Test::Unit::AutoRunner.need_auto_run = false
449
+ elsif defined?(Test::Unit.run = ())
450
+ Test::Unit.run = false
451
+ end
452
+ else
453
+ raise LoadError, <<-ERR.squeeze
454
+ Ruby 2.2+ doesn't support this version of Rails #{version}
455
+ ERR
456
+ end
457
+ else
458
+ require 'test/unit/assertions'
459
+ include Test::Unit::Assertions
460
+ if defined?(Test::Unit::AutoRunner.need_auto_run = ())
461
+ Test::Unit::AutoRunner.need_auto_run = false
462
+ elsif defined?(Test::Unit.run = ())
463
+ Test::Unit.run = false
464
+ end
465
+ end
419
466
  end
420
467
 
421
468
  require 'active_model/lint'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-activemodel-mocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chelimsky
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-06-02 00:00:00.000000000 Z
13
+ date: 2015-09-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -157,7 +157,7 @@ files:
157
157
  - spec/support/matchers.rb
158
158
  - spec/support/minitest_support.rb
159
159
  - spec/support/null_object.rb
160
- homepage: http://github.com/thomas-holmes/rspec-activemodel-mocks
160
+ homepage: https://github.com/rspec/rspec-activemodel-mocks
161
161
  licenses:
162
162
  - MIT
163
163
  metadata: {}
@@ -177,11 +177,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubyforge_project: rspec
181
- rubygems_version: 2.2.0
180
+ rubyforge_project:
181
+ rubygems_version: 2.2.2
182
182
  signing_key:
183
183
  specification_version: 4
184
- summary: rspec-activemodel-mocks-1.0.1
184
+ summary: rspec-activemodel-mocks-1.0.2
185
185
  test_files:
186
186
  - features/mocks/mock_model.feature
187
187
  - features/mocks/stub_model.feature