mocha 2.0.2 → 2.1.0

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
  SHA256:
3
- metadata.gz: 4f349dc7259b6d387aaf194adc6c6f93fe39b9b785ce42489e2abf168c58dc84
4
- data.tar.gz: '08a9210b39673183198a69a82d368b14af06722cc136a72635638b69a7a9e1b1'
3
+ metadata.gz: d4bd89c61177f213648b496bffa016c3546d6461da8552429560ff3f9804df4f
4
+ data.tar.gz: df6603b30f57ea57f6ba3383fc80df02ce0d94b246c35dd97b3eed80e689e717
5
5
  SHA512:
6
- metadata.gz: 1d77dedb5f4016ab1f2932a18b9d574a0e1de87ab0bc77cf5757920c8ca231a2c5872688a5c1dc8dbd530e81d9e8f1c6feb218c469126685ca822e953c568263
7
- data.tar.gz: 6545a73cfed1eb00f94ca06f1cd12606db4377c6e8a5f228a512464e106e129a584d6cedf195602dad45398a2e8346e2abd98c353209e41a4b13da64a9fbc635
6
+ metadata.gz: d3cb27ce0f13c163fb82a9ac9d3464ea3e0a2478a091033e1cb518a27db4dc4dad7ef16445a31cb363a31622b445413b132c7ffef29cc4b5c84183a7e951ec4d
7
+ data.tar.gz: ee6377fe60777af55832a284086920a4e1eff54824440f5ab4e9aa03c89e232034f0b0ec89abf5627de60c97d4f6405093144f37ec96217b31ba41ea125fd79b
data/.rubocop.yml CHANGED
@@ -11,22 +11,10 @@ Style/Alias:
11
11
  Style/Documentation:
12
12
  Enabled: false
13
13
 
14
- # Enumerable#each_with_object only available since Ruby v1.9
15
- Style/EachWithObject:
16
- Enabled: false
17
-
18
14
  # Kernel#__dir__ has only been available since Ruby v2.0
19
15
  Style/ExpandPathArguments:
20
16
  Enabled: false
21
17
 
22
- # Kernel#format has only supported named references since Ruby v1.9
23
- Style/FormatStringToken:
24
- EnforcedStyle: unannotated
25
-
26
- # ruby19 style has only been supported since Ruby v1.9
27
- Style/HashSyntax:
28
- EnforcedStyle: hash_rockets
29
-
30
18
  # I'm not keen on this cop, because it's easy to miss the conditional
31
19
  # I think the results are particularly unhelpful when Metrics/LineLength is big
32
20
  Style/IfUnlessModifier:
data/.yardopts CHANGED
@@ -1,5 +1,4 @@
1
1
  --output-dir docs
2
- --template-path yard-templates
3
2
  --no-private
4
3
  lib/mocha/api.rb
5
4
  lib/mocha/hooks.rb
data/COPYING.md CHANGED
@@ -1,3 +1,3 @@
1
- Copyright Revieworld Ltd. 2006
1
+ Copyright James Mead 2006
2
2
 
3
- You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).
3
+ You may use, copy and redistribute this library under the same terms as [Ruby itself](https://www.ruby-lang.org/en/about/license.txt) or under the [MIT license](https://mit-license.org/).
data/MIT-LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006 Revieworld Ltd.
1
+ Copyright (c) 2006 James Mead
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Mocha [![CircleCI status of freerange/mocha](https://circleci.com/gh/freerange/mocha.svg?style=shield&circle-token=bc1f6576c77da43ec58badde9273fa4eb1d7f53a)](https://app.circleci.com/pipelines/github/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.svg)](http://badge.fury.io/rb/mocha)
1
+ ## Mocha [![CircleCI status of freerange/mocha](https://circleci.com/gh/freerange/mocha.svg?style=shield)](https://app.circleci.com/pipelines/github/freerange/mocha) [![Gem Version](https://badge.fury.io/rb/mocha.svg)](http://badge.fury.io/rb/mocha)
2
2
 
3
3
  ### Description
4
4
 
@@ -331,14 +331,12 @@ See this [list of contributors](https://github.com/freerange/mocha/graphs/contri
331
331
  * Commit & push to GitHub
332
332
  * Check CircleCI build is passing - https://app.circleci.com/pipelines/github/freerange/mocha
333
333
 
334
- * Sign in to Google Analytics - https://analytics.google.com/analytics/web/
335
- * Find the web property ID for floehopper (625523) > Mocha Documentation (UA-625523-7)
336
334
  * Generate documentation:
337
335
 
338
336
  ```bash
339
337
  $ MOCHA_GENERATE_DOCS=true bundle install
340
338
 
341
- $ MOCHA_GENERATE_DOCS=true GOOGLE_ANALYTICS_WEB_PROPERTY_ID=UA-625523-7 rake generate_docs
339
+ $ MOCHA_GENERATE_DOCS=true rake generate_docs
342
340
  ```
343
341
  * Commit documentation & push to GitHub
344
342
  * Sign in to rubygems.org and find API key - https://rubygems.org/profile/edit
@@ -364,6 +362,6 @@ Mocha was initially harvested from projects at [Reevoo](http://www.reevoo.com/).
364
362
 
365
363
  ### License
366
364
 
367
- © Copyright Revieworld Ltd. 2006
365
+ © Copyright James Mead 2006
368
366
 
369
- You may use, copy and redistribute this library under the same terms as [Ruby itself](http://www.ruby-lang.org/en/LICENSE.txt) or under the [MIT license](http://www.opensource.org/licenses/MIT).
367
+ You may use, copy and redistribute this library under the same terms as [Ruby itself](https://www.ruby-lang.org/en/about/license.txt) or under the [MIT license](https://mit-license.org/).
data/RELEASE.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Release Notes
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### External changes
6
+
7
+ * Fix compatibility with Minitest (#614) - thanks to @kyrofa & @manewitz for reporting and to @zenspider for his input
8
+
9
+ ### Internal changes
10
+
11
+ * Update URLs for links to Ruby & MIT licenses (d6470af4)
12
+
13
+ ## 2.0.4
14
+
15
+ ### Internal changes
16
+
17
+ * Update `README.md` (e8c21e1b)
18
+
19
+ ## 2.0.3
20
+
21
+ ### External changes
22
+
23
+ * Fix `BacktraceFilter` to handle special characters (e242033f, #592) - thanks to @casperisfine
24
+
25
+ ### Internal changes
26
+
27
+ * Add Ruby v3.1 to the CircleCI build (3e460489)
28
+ * DRY up `regexp_matches` test (ae9fed4a)
29
+ * Fix regexp_matches tests in Ruby v3.2 (26b106a5, #590)
30
+ * Use Ruby 1.9 hash syntax (8bc0ad2f, #598, #537) - thanks to @herwinw
31
+ * Simplify storage of `MOCHA_OPTIONS` (b70507a1, #600) - thanks to @herwinw
32
+ * Pin JRuby to v9.3.9.0 in CircleCI builds (b8e6d064, #591)
33
+ * Rubocop: enable Style/FormatStringToken cop (089a688e, #603) - thanks to @herwinw
34
+ * Remove Ruby version check from `RespondsLikeTest` (21583129)
35
+ * Add Ruby v3.2 to CircleCI build (f7e17636, #601)
36
+ * Use Ruby v2.6 vs v2.2 to run lint CI job (af40b7db)
37
+ * Pin yard version to v0.9.28 to avoid `ArgumentError` (12f1eef7)
38
+ * Revert "Pin JRuby to v9.3.9.0 in CircleCI builds" (4f5bb2f0, #591)
39
+ * Remove invalid CircleCI token from badge URL (7078e76a)
40
+ * Revert "Pin yard version to v0.9.28 to avoid ArgumentError" (7c6c10c5, #609)
41
+ * Remove Google Analytics tracking code (2279c49d, #612)
42
+ * Update `MIT-LICENSE.md` (48162b4e)
43
+ * Update `COPYING.md` (f3152376)
44
+
3
45
  ## 2.0.2
4
46
 
5
47
  ### External changes
data/Rakefile CHANGED
@@ -111,7 +111,7 @@ def benchmark_test_case(klass, iterations)
111
111
  unless @silent_option
112
112
  begin
113
113
  load 'test/unit/ui/console/outputlevel.rb' unless defined?(Test::Unit::UI::Console::OutputLevel::SILENT)
114
- @silent_option = { :output_level => Test::Unit::UI::Console::OutputLevel::SILENT }
114
+ @silent_option = { output_level: Test::Unit::UI::Console::OutputLevel::SILENT }
115
115
  rescue LoadError
116
116
  @silent_option = Test::Unit::UI::SILENT
117
117
  end
@@ -129,14 +129,8 @@ if ENV['MOCHA_GENERATE_DOCS']
129
129
  `rm -rf ./docs`
130
130
  end
131
131
 
132
- task 'docs_environment' do
133
- unless ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID']
134
- puts "\nWarning: GOOGLE_ANALYTICS_WEB_PROPERTY_ID was not defined\n\n"
135
- end
136
- end
137
-
138
132
  desc 'Generate documentation'
139
- YARD::Rake::YardocTask.new('yardoc' => 'docs_environment') do |task|
133
+ YARD::Rake::YardocTask.new('yardoc') do |task|
140
134
  task.options = ['--title', "Mocha #{Mocha::VERSION}", '--fail-on-warning']
141
135
  end
142
136
 
@@ -3,11 +3,11 @@ module Mocha
3
3
  LIB_DIRECTORY = File.expand_path(File.join(File.dirname(__FILE__), '..')) + File::SEPARATOR
4
4
 
5
5
  def initialize(lib_directory = LIB_DIRECTORY)
6
- @path_pattern = Regexp.new(lib_directory)
6
+ @lib_directory = lib_directory
7
7
  end
8
8
 
9
9
  def filtered(backtrace)
10
- backtrace.reject { |location| @path_pattern.match(File.expand_path(location)) }
10
+ backtrace.reject { |location| File.expand_path(location).start_with?(@lib_directory) }
11
11
  end
12
12
  end
13
13
  end
@@ -39,13 +39,13 @@ module Mocha
39
39
  class Configuration
40
40
  # @private
41
41
  DEFAULTS = {
42
- :stubbing_method_unnecessarily => :allow,
43
- :stubbing_method_on_non_mock_object => :allow,
44
- :stubbing_non_existent_method => :allow,
45
- :stubbing_non_public_method => :allow,
46
- :stubbing_method_on_nil => :prevent,
47
- :display_matching_invocations_on_failure => false,
48
- :strict_keyword_argument_matching => false
42
+ stubbing_method_unnecessarily: :allow,
43
+ stubbing_method_on_non_mock_object: :allow,
44
+ stubbing_non_existent_method: :allow,
45
+ stubbing_non_public_method: :allow,
46
+ stubbing_method_on_nil: :prevent,
47
+ display_matching_invocations_on_failure: false,
48
+ strict_keyword_argument_matching: false
49
49
  }.freeze
50
50
 
51
51
  attr_reader :options
data/lib/mocha/debug.rb CHANGED
@@ -1,12 +1,9 @@
1
1
  module Mocha
2
2
  module Debug
3
- OPTIONS = (ENV['MOCHA_OPTIONS'] || '').split(',').inject({}) do |hash, key|
4
- hash[key] = true
5
- hash
6
- end.freeze
3
+ OPTIONS = (ENV['MOCHA_OPTIONS'] || '').split(',').freeze
7
4
 
8
5
  def self.puts(message)
9
- warn(message) if OPTIONS['debug']
6
+ warn(message) if OPTIONS.include?('debug')
10
7
  end
11
8
  end
12
9
  end
@@ -674,7 +674,7 @@ module Mocha
674
674
  def inspect
675
675
  address = __id__ * 2
676
676
  address += 0x100000000 if address < 0
677
- "#<Expectation:0x#{format('%x', address)} #{mocha_inspect} >"
677
+ "#<Expectation:0x#{format('%<address>x', address: address)} #{mocha_inspect} >"
678
678
  end
679
679
 
680
680
  # @private
data/lib/mocha/inspect.rb CHANGED
@@ -6,7 +6,7 @@ module Mocha
6
6
  def mocha_inspect
7
7
  address = __id__ * 2
8
8
  address += 0x100000000 if address < 0
9
- inspect =~ /#</ ? "#<#{self.class}:0x#{Kernel.format('%x', address)}>" : inspect
9
+ inspect =~ /#</ ? "#<#{self.class}:0x#{Kernel.format('%<address>x', address: address)}>" : inspect
10
10
  end
11
11
  end
12
12
 
@@ -23,7 +23,7 @@ module Mocha
23
23
 
24
24
  # @private
25
25
  def self.included(_mod)
26
- Mocha::ExpectationErrorFactory.exception_class = ::MiniTest::Assertion
26
+ Mocha::ExpectationErrorFactory.exception_class = ::Minitest::Assertion
27
27
  end
28
28
 
29
29
  # @private
@@ -23,16 +23,16 @@ module Mocha
23
23
 
24
24
  # @private
25
25
  def self.included(mod)
26
- mod.setup :mocha_setup, :before => :prepend
26
+ mod.setup :mocha_setup, before: :prepend
27
27
 
28
28
  mod.exception_handler(:handle_mocha_expectation_error)
29
29
 
30
- mod.cleanup :after => :append do
30
+ mod.cleanup after: :append do
31
31
  assertion_counter = Integration::AssertionCounter.new(self)
32
32
  mocha_verify(assertion_counter)
33
33
  end
34
34
 
35
- mod.teardown :mocha_teardown, :after => :append
35
+ mod.teardown :mocha_teardown, after: :append
36
36
  end
37
37
 
38
38
  private
data/lib/mocha/names.rb CHANGED
@@ -37,7 +37,7 @@ module Mocha
37
37
  def mocha_inspect
38
38
  address = @mock.__id__ * 2
39
39
  address += 0x100000000 if address < 0
40
- "#<Mock:0x#{format('%x', address)}>"
40
+ "#<Mock:0x#{format('%<address>x', address: address)}>"
41
41
  end
42
42
  end
43
43
  end
@@ -50,7 +50,7 @@ module Mocha
50
50
  # @private
51
51
  def explode(uri)
52
52
  query_hash = CGI.parse(uri.query || '')
53
- URI::Generic::COMPONENT.inject({}) { |h, k| h.merge(k => uri.__send__(k)) }.merge(:query => query_hash)
53
+ URI::Generic::COMPONENT.inject({}) { |h, k| h.merge(k => uri.__send__(k)) }.merge(query: query_hash)
54
54
  end
55
55
  end
56
56
  end
data/lib/mocha/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mocha
2
- VERSION = '2.0.2'.freeze
2
+ VERSION = '2.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mocha
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Mead
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby2_keywords
@@ -128,8 +128,6 @@ files:
128
128
  - lib/mocha/version.rb
129
129
  - lib/mocha/yield_parameters.rb
130
130
  - mocha.gemspec
131
- - yard-templates/default/layout/html/google_analytics.erb
132
- - yard-templates/default/layout/html/setup.rb
133
131
  homepage: https://mocha.jamesmead.org
134
132
  licenses:
135
133
  - MIT
@@ -150,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
148
  - !ruby/object:Gem::Version
151
149
  version: '0'
152
150
  requirements: []
153
- rubygems_version: 3.3.3
151
+ rubygems_version: 3.4.1
154
152
  signing_key:
155
153
  specification_version: 4
156
154
  summary: Mocking and stubbing library
@@ -1,8 +0,0 @@
1
- <script async src="https://www.googletagmanager.com/gtag/js?id=<%= ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] %>"></script>
2
- <script>
3
- window.dataLayer = window.dataLayer || [];
4
- function gtag(){dataLayer.push(arguments);}
5
- gtag('js', new Date());
6
-
7
- gtag('config', '<%= ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] %>');
8
- </script>
@@ -1,5 +0,0 @@
1
- def init
2
- super
3
- return unless ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID']
4
- sections[:layout] << :google_analytics
5
- end