minitest-stub_any_instance 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 29c09d162c9eb62d1ea86dafab57a4a944e65ecf
4
+ data.tar.gz: f22daa3a8bf6214b6bb90a2d6e0fbd2f8bfa2534
5
+ SHA512:
6
+ metadata.gz: 0251e396cbdbb19c4b8ef00b4199e61ff5ea400a74b47dabe5eebaa8893924873f3f038bf3ee997ff42ea5b3677008d91b8c080436678e44c1adda86b23701aa
7
+ data.tar.gz: 1fa745a25c4dcd93dffb102555c8e9c093183b1b558f450152ec9e72b1311eca024eaa3cb7fdfe5eb5023a9f2cee91d9528c369cb837014baeb410e2a62a1fa0
@@ -7,7 +7,7 @@ class Object
7
7
 
8
8
  define_method(name) do |*args|
9
9
  if val_or_callable.respond_to? :call then
10
- val_or_callable.call(*args)
10
+ instance_exec(*args, &val_or_callable)
11
11
  else
12
12
  val_or_callable
13
13
  end
@@ -33,4 +33,12 @@ class TestStubAnyInstance < MiniTest::Unit::TestCase
33
33
  assert_empty $stderr.string
34
34
  assert got_here
35
35
  end
36
+
37
+ def test_proc_has_access_to_self
38
+ twice_size = -> { self.size * 2 }
39
+ String.stub_any_instance(:length, twice_size) do
40
+ assert_equal 6, 'abc'.length
41
+ end
42
+ end
43
+
36
44
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-stub_any_instance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sammy Larbi
@@ -10,30 +9,36 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-09-22 00:00:00.000000000Z
12
+ date: 2015-01-24 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: bundler
17
- requirement: &2166611180 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
- - - ~>
18
+ - - "~>"
21
19
  - !ruby/object:Gem::Version
22
20
  version: '1.3'
23
21
  type: :development
24
22
  prerelease: false
25
- version_requirements: *2166611180
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.3'
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: rake
28
- requirement: &2166610720 !ruby/object:Gem::Requirement
29
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ! '>='
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
- version_requirements: *2166610720
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
37
42
  description: Adds a method to MiniTest that stubs any instance of a class.
38
43
  email:
39
44
  - sam@codeodor.com
@@ -46,27 +51,26 @@ files:
46
51
  homepage: https://github.com/codeodor/minitest-stub_any_instance
47
52
  licenses:
48
53
  - MIT
54
+ metadata: {}
49
55
  post_install_message:
50
56
  rdoc_options: []
51
57
  require_paths:
52
58
  - lib
53
59
  required_ruby_version: !ruby/object:Gem::Requirement
54
- none: false
55
60
  requirements:
56
- - - ! '>='
61
+ - - ">="
57
62
  - !ruby/object:Gem::Version
58
63
  version: '0'
59
64
  required_rubygems_version: !ruby/object:Gem::Requirement
60
- none: false
61
65
  requirements:
62
- - - ! '>='
66
+ - - ">="
63
67
  - !ruby/object:Gem::Version
64
68
  version: '0'
65
69
  requirements: []
66
70
  rubyforge_project:
67
- rubygems_version: 1.8.8
71
+ rubygems_version: 2.4.3
68
72
  signing_key:
69
- specification_version: 3
73
+ specification_version: 4
70
74
  summary: ''
71
75
  test_files:
72
76
  - test/stub_any_instance_test.rb