-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended maintenance of Ruby v1.8.7 ended on 31 Jul 2014 [1] and Mocha support for Ruby v1.8 has been deprecated since v1.10 [2]. Recent work in #534 has run into problems with files containing keyword arguments not being parsable by Ruby v1.8 and so I think the time has come to drop support. Note that I had to change a couple of hard-coded line numbers in unit tests to match up with the changed source code in lib/mocha/stubbed_method.rb. [1]: https://www.ruby-lang.org/en/news/2014/07/01/eol-for-1-8-7-and-1-9-2/ [2]: c5f8496
- Loading branch information
1 parent
1ade384
commit ddb5d67
Showing
23 changed files
with
43 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,6 @@ workflows: | |
matrix: | ||
parameters: | ||
docker-image: | ||
- mudge/re2-ci:1.8 | ||
- ruby:1.9 | ||
- ruby:2.0 | ||
- ruby:2.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
require 'mocha/version' | ||
require 'mocha/ruby_version' | ||
require 'mocha/deprecation' | ||
|
||
if Mocha::PRE_RUBY_V19 | ||
Mocha::Deprecation.warning( | ||
'Versions of Ruby earlier than v1.9 will not be supported in future versions of Mocha.' | ||
) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
require 'mocha/ruby_version' | ||
require 'mocha/stubbed_method' | ||
|
||
module Mocha | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
module Mocha | ||
PRE_RUBY_V19 = Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('1.9') | ||
RUBY_V2_PLUS = Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2') | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 23 additions & 25 deletions
48
test/acceptance/stub_method_defined_on_module_and_aliased_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,36 @@ | ||
require File.expand_path('../acceptance_test_helper', __FILE__) | ||
|
||
unless Mocha::PRE_RUBY_V19 | ||
class StubMethodDefinedOnModuleAndAliasedTest < Mocha::TestCase | ||
include AcceptanceTest | ||
class StubMethodDefinedOnModuleAndAliasedTest < Mocha::TestCase | ||
include AcceptanceTest | ||
|
||
def setup | ||
setup_acceptance_test | ||
end | ||
def setup | ||
setup_acceptance_test | ||
end | ||
|
||
def teardown | ||
teardown_acceptance_test | ||
end | ||
def teardown | ||
teardown_acceptance_test | ||
end | ||
|
||
def test_stubbing_class_method_defined_by_aliasing_module_instance_method | ||
mod = Module.new do | ||
def module_instance_method | ||
'module-instance-method' | ||
end | ||
def test_stubbing_class_method_defined_by_aliasing_module_instance_method | ||
mod = Module.new do | ||
def module_instance_method | ||
'module-instance-method' | ||
end | ||
end | ||
|
||
klass = Class.new do | ||
extend mod | ||
class << self | ||
alias_method :aliased_module_instance_method, :module_instance_method | ||
end | ||
klass = Class.new do | ||
extend mod | ||
class << self | ||
alias_method :aliased_module_instance_method, :module_instance_method | ||
end | ||
end | ||
|
||
assert_snapshot_unchanged(klass) do | ||
test_result = run_as_test do | ||
klass.stubs(:aliased_module_instance_method).returns('stubbed-aliased-module-instance-method') | ||
assert_equal 'stubbed-aliased-module-instance-method', klass.aliased_module_instance_method | ||
end | ||
assert_passed(test_result) | ||
assert_snapshot_unchanged(klass) do | ||
test_result = run_as_test do | ||
klass.stubs(:aliased_module_instance_method).returns('stubbed-aliased-module-instance-method') | ||
assert_equal 'stubbed-aliased-module-instance-method', klass.aliased_module_instance_method | ||
end | ||
assert_passed(test_result) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
require 'mocha/ruby_version' | ||
|
||
module Assertions | ||
def assert_method_visibility(object, method_name, visiblity) | ||
method_key = Mocha::PRE_RUBY_V19 ? method_name.to_s : method_name.to_sym | ||
method_key = method_name.to_sym | ||
assert object.send("#{visiblity}_methods").include?(method_key), "#{method_name} is not #{visiblity}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.