arbitrary_mock 0.0.3 → 0.1.0.pre

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: 15247826067dca8d5df6a11a64fb3a47905013b5
4
- data.tar.gz: eb29ae2b66f1913e849960189a96efa53d400e7f
3
+ metadata.gz: 0289b1653e5dc1b79d6ce6a50405fb70b746f29a
4
+ data.tar.gz: 1d6981a806f63a0e172f2a49d7a0b2f0dc98e7e2
5
5
  SHA512:
6
- metadata.gz: 98d7ea0a65965d21739b7fa383c7f00e626ea9b5a798db628aa4bfb02f3e1d240c7340aa1fbd3c3167493d53cbef350fad56ec0ae9a93e40decee89730ef5caf
7
- data.tar.gz: 33cd8f28a9b8cefc687c54ed376ffcfb2d06296aade904ce5d757053e14e126021b10dc390f2a5aa5fd5b88a63b348ae84793a399aa48418de4d069782edc251
6
+ metadata.gz: bc343cc640841f75730406f0e85dc5f8f63e0039999628ebf133897ee1c08b577914231201410edfa8f3f7a70a563044db20edc7542062721f5a4ec648f52fc2
7
+ data.tar.gz: 72cc8bcfc4f0e7dcfac36181b167e89a6e9d0db4498c5f025991d3d3f6f4c0227448dd6db1494391e89f680dfe437c61a55e4cf3179d15869779583cbfeec9fa
data/README.md CHANGED
@@ -30,5 +30,4 @@ specific assertions about the way the class functions.
30
30
  expect(dependency.attribute).to match 'some_value'
31
31
 
32
32
 
33
-
34
33
  This project rocks and uses MIT-LICENSE.
@@ -7,12 +7,19 @@ module ArbitraryMock
7
7
 
8
8
  def method_missing(*args)
9
9
  method_name = args.first
10
+ arg_position = 1
11
+
12
+ if method_name == :try
13
+ method_name = args[1]
14
+ arg_position += 1
15
+ end
16
+
10
17
  setter_method_match = /(.*)=$/.match(method_name)
11
18
 
12
19
  return @property_hash[method_name] if setter_method_match.nil?
13
20
 
14
21
  setter_method = setter_method_match.captures.first.to_sym
15
- @property_hash[setter_method] = args[1]
22
+ @property_hash[setter_method] = args[arg_position]
16
23
  end
17
24
  end
18
25
  end
@@ -1,3 +1,3 @@
1
1
  module ArbitraryMock
2
- VERSION = "0.0.3"
2
+ VERSION = '0.1.0.pre'
3
3
  end
@@ -1,12 +1,14 @@
1
1
  require 'arbitrary_mock/base'
2
2
 
3
3
  describe ArbitraryMock::Base do
4
- it 'allows you to define attributes within an initial array' do
5
- mock = ArbitraryMock::Base.new(foo: 'bar')
6
- expect(mock.foo).to match 'bar'
4
+ describe '#initialize' do
5
+ it 'allows you to set arbitrary attributes' do
6
+ mock = ArbitraryMock::Base.new(foo: 'bar')
7
+ expect(mock.foo).to match 'bar'
8
+ end
7
9
  end
8
10
 
9
- it 'allows you to set arbitrary attributes' do
11
+ it 'allows you to set attributes as setters' do
10
12
  mock = ArbitraryMock::Base.new
11
13
  mock.foo = 'bar'
12
14
  expect(mock.foo).to match 'bar'
@@ -22,4 +24,9 @@ describe ArbitraryMock::Base do
22
24
  MyClass ||= ArbitraryMock::Base
23
25
  MyClass.new(foo: 'bar').foo.should == 'bar'
24
26
  end
27
+
28
+ it 'allows you to "try" a method' do
29
+ MyClass ||= ArbitraryMock::Base
30
+ MyClass.new(foo: 'bar').try(:foo).should == 'bar'
31
+ end
25
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbitrary_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-26 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,9 +86,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - '>='
89
+ - - '>'
90
90
  - !ruby/object:Gem::Version
91
- version: '0'
91
+ version: 1.3.1
92
92
  requirements: []
93
93
  rubyforge_project:
94
94
  rubygems_version: 2.0.3