arbitrary_mock 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a76113f5c4f334af003f37b169c3f2eeaa9e9a67
4
+ data.tar.gz: 889f739987e69227ce9c7979b27924954b388105
5
+ SHA512:
6
+ metadata.gz: b74fccd327df6e39143828214715b6f2542e0c99ddfbb650044215288e9651c58d780c605b411d9ad280bcfcf3233827d851a9ef778bc805e2a4484868bedcbc
7
+ data.tar.gz: f8aa1618fbcce9d720761646cd24b1d84e90da575ada63c1d6ca3d9aa0a7ac6b3b15f7f65bc66330df55106c34983a20efa57de7f1311c0c021b480e5b672cba
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ ���"pP�{�U�b��˦|8�T�Gk��d��D�����KPϜ8�ie%3�/8 �=;d��-= )�s~SĀ �$ŋY���W�(�{3�Oz��,v�"��u���:rbn�f4�[m�я-}����T�������%8���
2
+ �O�ͷ���)�@kQ�Dj���/�D\�pC��L�sJ��Dl����U�U�Y���Gc��b��6^�����[�YDz���.���y�`9m$5;8}_��_�w�m�e�arO]:�NGT
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ .ruby-version
5
+ .ruby-gemset
6
+
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in arbitrary_mock.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ arbitrary_mock (0.0.1)
5
+ rails (>= 2.3.0)
6
+ rspec (>= 2.0.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.0.0)
12
+ actionpack (= 4.0.0)
13
+ mail (~> 2.5.3)
14
+ actionpack (4.0.0)
15
+ activesupport (= 4.0.0)
16
+ builder (~> 3.1.0)
17
+ erubis (~> 2.7.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.0)
21
+ activesupport (= 4.0.0)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.0)
24
+ activemodel (= 4.0.0)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.0)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.3)
29
+ activesupport (4.0.0)
30
+ i18n (~> 0.6, >= 0.6.4)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ arel (4.0.0)
36
+ atomic (1.1.14)
37
+ builder (3.1.4)
38
+ diff-lcs (1.2.4)
39
+ erubis (2.7.0)
40
+ hike (1.2.3)
41
+ i18n (0.6.5)
42
+ mail (2.5.4)
43
+ mime-types (~> 1.16)
44
+ treetop (~> 1.4.8)
45
+ mime-types (1.25)
46
+ minitest (4.7.5)
47
+ multi_json (1.8.2)
48
+ polyglot (0.3.3)
49
+ rack (1.5.2)
50
+ rack-test (0.6.2)
51
+ rack (>= 1.0)
52
+ rails (4.0.0)
53
+ actionmailer (= 4.0.0)
54
+ actionpack (= 4.0.0)
55
+ activerecord (= 4.0.0)
56
+ activesupport (= 4.0.0)
57
+ bundler (>= 1.3.0, < 2.0)
58
+ railties (= 4.0.0)
59
+ sprockets-rails (~> 2.0.0)
60
+ railties (4.0.0)
61
+ actionpack (= 4.0.0)
62
+ activesupport (= 4.0.0)
63
+ rake (>= 0.8.7)
64
+ thor (>= 0.18.1, < 2.0)
65
+ rake (10.1.0)
66
+ rspec (2.14.1)
67
+ rspec-core (~> 2.14.0)
68
+ rspec-expectations (~> 2.14.0)
69
+ rspec-mocks (~> 2.14.0)
70
+ rspec-core (2.14.6)
71
+ rspec-expectations (2.14.3)
72
+ diff-lcs (>= 1.1.3, < 2.0)
73
+ rspec-mocks (2.14.4)
74
+ sprockets (2.10.0)
75
+ hike (~> 1.2)
76
+ multi_json (~> 1.0)
77
+ rack (~> 1.0)
78
+ tilt (~> 1.1, != 1.3.0)
79
+ sprockets-rails (2.0.1)
80
+ actionpack (>= 3.0)
81
+ activesupport (>= 3.0)
82
+ sprockets (~> 2.8)
83
+ thor (0.18.1)
84
+ thread_safe (0.1.3)
85
+ atomic
86
+ tilt (1.4.1)
87
+ treetop (1.4.15)
88
+ polyglot
89
+ polyglot (>= 0.3.1)
90
+ tzinfo (0.3.38)
91
+
92
+ PLATFORMS
93
+ ruby
94
+
95
+ DEPENDENCIES
96
+ arbitrary_mock!
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # ArbitraryMock
2
+
3
+ ArbitraryMock is a basic object used for easily asserting the behaviours of
4
+ utility classes without loading the dependencies themselves, or making
5
+ specific assertions about the way the class functions.
6
+
7
+
8
+ ## Example
9
+
10
+ ### Basic
11
+
12
+ 2.0.0p247 :003 > require 'arbitrary_mock'
13
+ => true
14
+ 2.0.0p247 :004 > mock = ArbitraryMock::Base.new(foo: 'bar')
15
+ => #<ArbitraryMock::Base:0x007f97710eade8 @property_hash={:foo=>"bar"}>
16
+ 2.0.0p247 :005 > mock.foo
17
+ => "bar"
18
+ 2.0.0p247 :006 > mock.property_hash
19
+ => nil
20
+ 2.0.0p247 :007 > mock.foo = 'baz'
21
+ => "baz"
22
+ 2.0.0p247 :008 > mock.foo
23
+ => "baz"
24
+ 2.0.0p247 :009 > mock.foo << 'quux'
25
+ => "bazquux"
26
+ 2.0.0p247 :010 > mock.foo
27
+ => "bazquux"
28
+ 2.0.0p247 :011 >
29
+
30
+ ### Usage
31
+
32
+ Model < ArbitraryMock::Base; end
33
+ dependency = Model.new(foo: 'bar')
34
+ Model.stub(new: dependency)
35
+
36
+ ## insert logic here
37
+ expect(dependency.attribute).to match 'some_value'
38
+
39
+
40
+
41
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'arbitrary_mock/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "arbitrary_mock"
8
+ spec.version = ArbitraryMock::VERSION
9
+ spec.authors = ["Robert White"]
10
+ spec.email = ["robert@terracoding.com"]
11
+ spec.summary = "Basic object for asserting behaviour of classes upon their dependencies"
12
+ spec.description = "Basic series of objects designed to allow you to arbitrarily assign and access properties, for use in conjunction with typical isolated testing style."
13
+ spec.homepage = "https://github.com/Haar/arbitrary_mock"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", ">= 2.0.0"
24
+ end
@@ -0,0 +1,18 @@
1
+ module ArbitraryMock
2
+ class Base
3
+
4
+ def initialize(property_hash={})
5
+ @property_hash = property_hash
6
+ end
7
+
8
+ def method_missing(*args)
9
+ method_name = args.first
10
+ setter_method_match = /(.*)=$/.match(method_name)
11
+
12
+ return @property_hash[method_name] if setter_method_match.nil?
13
+
14
+ setter_method = setter_method_match.captures.first.to_sym
15
+ @property_hash[setter_method] = args[1]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module ArbitraryMock
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,5 @@
1
+ require 'arbitrary_mock/version'
2
+ require 'arbitrary_mock/base'
3
+
4
+ module ArbitraryMock
5
+ end
data/spec/base_spec.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'arbitrary_mock/base'
2
+
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'
7
+ end
8
+
9
+ it 'allows you to set arbitrary attributes' do
10
+ mock = ArbitraryMock::Base.new
11
+ mock.foo = 'bar'
12
+ expect(mock.foo).to match 'bar'
13
+ end
14
+
15
+ it 'allows you to directly modify attributes' do
16
+ mock = ArbitraryMock::Base.new(foo: 'bar')
17
+ mock.foo << 'bang'
18
+ expect(mock.foo).to match 'barbang'
19
+ end
20
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �/S K�ğ}8qD�]�'w�Y�4X����Y�_@2�(�g�%tb��>�&y;LE>i;R���^ δZ��*�3p'���/T�񪐣��@ZR�P�!I�r�:W;U��ϡ���v�m�`� 91�K]n�Y�Ā��f�.sG��_�r��]߶������/&t���}���;�ͺ9k��e�L\V�k�o�m��X��]�NGRD� ������+Pa/?����0ez����Q� ��;���
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arbitrary_mock
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Robert White
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMQ8wDQYDVQQDDAZyb2Jl
14
+ cnQxGzAZBgoJkiaJk/IsZAEZFgt0ZXJyYWNvZGluZzETMBEGCgmSJomT8ixkARkW
15
+ A2NvbTAeFw0xMzA1MjIxMDUwMjBaFw0xNDA1MjIxMDUwMjBaMEMxDzANBgNVBAMM
16
+ BnJvYmVydDEbMBkGCgmSJomT8ixkARkWC3RlcnJhY29kaW5nMRMwEQYKCZImiZPy
17
+ LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIXh2579
18
+ FugrtZQfTbZ2ItXQSp+FGyu7+SgDjHY9xkp606pkuHrvj1ROU8jYwrzJJVmKCA+n
19
+ GJia+Ae3amD1PVLHkt+lawy0I+V6MICbOh5PlXN9ZWj+apOMKROpjfK8gNNG62vs
20
+ dltcT8CBP5J8WJkY4erqXlsumsIKo3QqtxYOEcYCzdS4OtIZzpv3+UwPff6kMRva
21
+ 6HTwp4vEiFOa3MZ9SVadx6apWKb2s+reYmOzNmOVIFWEq1y8/ee4/LB7vnIcn/Qj
22
+ SjUahk7UFHd3/K8QG3R2BYTpf8rjsE86U8Wp4RiD7hJm+4ehfjzgL+z7yCv++Fnm
23
+ BkfuQfQo/372bwIDAQABozkwNzAJBgNVHRMEAjAAMB0GA1UdDgQWBBQZM7VbUjVo
24
+ hV5DNa/wQ/ZHtyjDZDALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBAGx1
25
+ b/y4RGTbnw6Mo4JZGIxZwjY5YLPp6DQPcd+WeiztEBm2UrU6MrIG7pZjdk9iIrKE
26
+ 0S182EnvKm9SWNiRuRhXAzaP5CzAiOsLa1kC9g3cgjh+3OsRtfyCRTtV/e+H51gt
27
+ yKksdoqckfo2nLVmxQzREUls8q/vSRrDAKFf+nuRMnNBZ3Dl8Y/x1Prwu8DCj0jg
28
+ 71iqVd/h8843YfKnKMuNSHIE7R56Ilu5E3BFIZWM9g6qKB6OgUOhQ2+wahgqP65E
29
+ yOQEOf/NLAgxfk2F5mfx7TKOUIDwF0kOPsRyelhOeiHrH/7gAL6VMD3eaFwHYDbL
30
+ +IKaQB3NaFv3kZnspdg=
31
+ -----END CERTIFICATE-----
32
+ date: 2013-10-18 00:00:00.000000000 Z
33
+ dependencies:
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.0
76
+ description: Basic series of objects designed to allow you to arbitrarily assign and
77
+ access properties, for use in conjunction with typical isolated testing style.
78
+ email:
79
+ - robert@terracoding.com
80
+ executables: []
81
+ extensions: []
82
+ extra_rdoc_files: []
83
+ files:
84
+ - .gitignore
85
+ - Gemfile
86
+ - Gemfile.lock
87
+ - MIT-LICENSE
88
+ - README.md
89
+ - Rakefile
90
+ - arbitrary_mock.gemspec
91
+ - lib/arbitrary_mock.rb
92
+ - lib/arbitrary_mock/base.rb
93
+ - lib/arbitrary_mock/version.rb
94
+ - spec/base_spec.rb
95
+ homepage: https://github.com/Haar/arbitrary_mock
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.0.6
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Basic object for asserting behaviour of classes upon their dependencies
119
+ test_files:
120
+ - spec/base_spec.rb
metadata.gz.sig ADDED
Binary file