fakery 0.1.0

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: 53c31aa787a8c9a059340fa40fbf412a5d863f70
4
+ data.tar.gz: f2adf0d385e2b3e090a66f1066edd0845d3813c7
5
+ SHA512:
6
+ metadata.gz: 4871051c30bc49d99887e3360567d62c00c5d5356e254b8d89c3a9c5584b5b330bf47fcbbfc8cfc5f4bd7d4a905d8abad7b0a961844c9d9fcbe61c0688bb96dc
7
+ data.tar.gz: 36e6ad3ff98d671b51976521786e7a147440d3f656fb55ea8417a5a13c2deb5063872d7690d2d220ee354c9197e855fb88008ec705440999caabee59c3a0f239
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .*.sw[pon]
2
+ .AppleDouble
3
+ .DS_Store
4
+ .ruby-version
5
+ .rvmrc
6
+ .utilsrc
7
+ Gemfile.lock
8
+ coverage
9
+ doc
10
+ pkg
11
+ tags
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --backtrace
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 2.1.5
3
+ matrix:
4
+ allow_failures:
5
+ - rvm: ruby-head
6
+ env:
7
+ - START_SIMPLECOV=1 CODECLIMATE_REPO_TOKEN=af3a05003c763bcee8abfdd7d7c46cc122c02ea09e5a71c3e16cf0a26685a851
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem "codeclimate-test-reporter", group: :test, require: false
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ fakery
2
+ ======
3
+
4
+ Descripton
5
+ ----------
6
+ Faking Ruby objects from JSON API responses
7
+
8
+ Badges
9
+ ------
10
+
11
+ [![Build Status](https://travis-ci.org/betterplace/fakery.svg?branch=master)](https://travis-ci.org/betterplace/fakery)
12
+ [![Code Climate](https://codeclimate.com/github/betterplace/fakery.png)](https://codeclimate.com/github/betterplace/fakery)
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ require 'gem_hadar'
4
+
5
+ GemHadar do
6
+ name 'fakery'
7
+ author 'betterplace Developers'
8
+ email 'developers@betterplace.org'
9
+ homepage "http://github.com/betterplace/#{name}"
10
+ summary 'Fake Ruby objects from JSON API responses'
11
+ description "This library fakes ruby objects from JSON API responses for testing purposes."
12
+ test_dir 'spec'
13
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
14
+ '.ruby-version', '.AppleDouble', 'tags', '.DS_Store', '.utilsrc', 'doc'
15
+ readme 'README.md'
16
+ title "#{name.camelize} -- "
17
+
18
+ dependency 'tins', '~>1.0'
19
+ dependency 'term-ansicolor', '~>1.3'
20
+ dependency 'typhoeus', '~>1.0'
21
+ dependency 'json', '~>1.0'
22
+ development_dependency 'simplecov'
23
+ development_dependency 'rspec', '~>3.0'
24
+ development_dependency 'rspec-nc'
25
+ development_dependency 'byebug'
26
+ end
27
+
28
+ task :default => :spec
data/TODO.md ADDED
@@ -0,0 +1,4 @@
1
+ TODO
2
+ ====
3
+
4
+ - Method to build instances of classes based on fakes.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/fakery.gemspec ADDED
@@ -0,0 +1,57 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # stub: fakery 0.1.0 ruby lib
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "fakery"
6
+ s.version = "0.1.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
10
+ s.authors = ["betterplace Developers"]
11
+ s.date = "2016-01-28"
12
+ s.description = "This library fakes ruby objects from JSON API responses for testing purposes."
13
+ s.email = "developers@betterplace.org"
14
+ s.extra_rdoc_files = ["README.md", "lib/fakery.rb", "lib/fakery/api.rb", "lib/fakery/api_error.rb", "lib/fakery/change.rb", "lib/fakery/fake.rb", "lib/fakery/fakery_error.rb", "lib/fakery/registry.rb", "lib/fakery/seeding.rb", "lib/fakery/version.rb", "lib/fakery/wrapping.rb"]
15
+ s.files = [".gitignore", ".rspec", ".travis.yml", "Gemfile", "LICENSE", "README.md", "Rakefile", "TODO.md", "VERSION", "fakery.gemspec", "lib/fakery.rb", "lib/fakery/api.rb", "lib/fakery/api_error.rb", "lib/fakery/change.rb", "lib/fakery/fake.rb", "lib/fakery/fakery_error.rb", "lib/fakery/registry.rb", "lib/fakery/seeding.rb", "lib/fakery/version.rb", "lib/fakery/wrapping.rb", "spec/api_spec.rb", "spec/change_spec.rb", "spec/fake_spec.rb", "spec/registry_spec.rb", "spec/seeding_spec.rb", "spec/spec_helper.rb", "spec/wrapping_spec.rb"]
16
+ s.homepage = "http://github.com/betterplace/fakery"
17
+ s.rdoc_options = ["--title", "Fakery -- ", "--main", "README.md"]
18
+ s.rubygems_version = "2.5.1"
19
+ s.summary = "Fake Ruby objects from JSON API responses"
20
+ s.test_files = ["spec/api_spec.rb", "spec/change_spec.rb", "spec/fake_spec.rb", "spec/registry_spec.rb", "spec/seeding_spec.rb", "spec/spec_helper.rb", "spec/wrapping_spec.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 4
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<gem_hadar>, ["~> 1.3.1"])
27
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
28
+ s.add_development_dependency(%q<rspec>, ["~> 3.0"])
29
+ s.add_development_dependency(%q<rspec-nc>, [">= 0"])
30
+ s.add_development_dependency(%q<byebug>, [">= 0"])
31
+ s.add_runtime_dependency(%q<tins>, ["~> 1.0"])
32
+ s.add_runtime_dependency(%q<term-ansicolor>, ["~> 1.3"])
33
+ s.add_runtime_dependency(%q<typhoeus>, ["~> 1.0"])
34
+ s.add_runtime_dependency(%q<json>, ["~> 1.0"])
35
+ else
36
+ s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
37
+ s.add_dependency(%q<simplecov>, [">= 0"])
38
+ s.add_dependency(%q<rspec>, ["~> 3.0"])
39
+ s.add_dependency(%q<rspec-nc>, [">= 0"])
40
+ s.add_dependency(%q<byebug>, [">= 0"])
41
+ s.add_dependency(%q<tins>, ["~> 1.0"])
42
+ s.add_dependency(%q<term-ansicolor>, ["~> 1.3"])
43
+ s.add_dependency(%q<typhoeus>, ["~> 1.0"])
44
+ s.add_dependency(%q<json>, ["~> 1.0"])
45
+ end
46
+ else
47
+ s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
48
+ s.add_dependency(%q<simplecov>, [">= 0"])
49
+ s.add_dependency(%q<rspec>, ["~> 3.0"])
50
+ s.add_dependency(%q<rspec-nc>, [">= 0"])
51
+ s.add_dependency(%q<byebug>, [">= 0"])
52
+ s.add_dependency(%q<tins>, ["~> 1.0"])
53
+ s.add_dependency(%q<term-ansicolor>, ["~> 1.3"])
54
+ s.add_dependency(%q<typhoeus>, ["~> 1.0"])
55
+ s.add_dependency(%q<json>, ["~> 1.0"])
56
+ end
57
+ end
data/lib/fakery.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'set'
2
+ require 'tins'
3
+ require 'tins/xt/ask_and_send'
4
+ require 'json'
5
+ require 'typhoeus'
6
+ require 'forwardable'
7
+
8
+ module Fakery
9
+ require 'fakery/version'
10
+ require 'fakery/fakery_error'
11
+ require 'fakery/api_error'
12
+ require 'fakery/api'
13
+ require 'fakery/change'
14
+ require 'fakery/fake'
15
+ require 'fakery/registry'
16
+ require 'fakery/seeding'
17
+ require 'fakery/wrapping'
18
+
19
+ class << self
20
+ extend Forwardable
21
+
22
+ def_delegators :'Fakery::Registry', :register, :registered?, :build,
23
+ :source
24
+
25
+ def_delegators :'Fakery::Seeding', :seed, :reseed
26
+
27
+ def_delegators :'Fakery::Wrapping', :http_response, :instance
28
+ end
29
+ end
data/lib/fakery/api.rb ADDED
@@ -0,0 +1,29 @@
1
+ module Fakery::Api
2
+ module_function
3
+
4
+ # Get a http response from +url+ with parameters +params+.
5
+ def get_response(url, params: {})
6
+ Typhoeus.get(url, params: params)
7
+ end
8
+
9
+ # Get the +url+ and parse the response body into a Fakery::Fake object. If
10
+ # this is unsuccessful or an invalid JSON text is returned, this method will
11
+ # throw a Fakery::ApiError exception.
12
+ def get(url, params: {})
13
+ response = get_response(url, params: params)
14
+ if response.success?
15
+ JSON.parse response.body, object_class: Fakery::Fake
16
+ else
17
+ raise Fakery::ApiError.new(
18
+ "api responded with http_status=#{response.code} "\
19
+ "message=#{response.return_message.inspect}",
20
+ response: response
21
+ )
22
+ end
23
+ rescue JSON::ParserError => e
24
+ raise Fakery::ApiError.new(
25
+ "#{e.class}: #{e.message}",
26
+ response: response
27
+ )
28
+ end
29
+ end
@@ -0,0 +1,8 @@
1
+ class Fakery::ApiError < Fakery::FakeryError
2
+ def initialize(*args, **opts)
3
+ super(*args)
4
+ @response = opts[:response]
5
+ end
6
+
7
+ attr_reader :response
8
+ end
@@ -0,0 +1,69 @@
1
+ class Fakery::Change
2
+ # +name+ is the name of the changed field. +from+ is the original value from
3
+ # which the field was changed. +to+ is the new value to which the field was
4
+ # changed. If +added+ is false (default) this is a change from previously set
5
+ # value, if it's true then this change is a new addition of a field.
6
+ def initialize(name: nil, from: nil, to: nil, added: false) # TODO remove nil in Ruby 2.1
7
+ name or raise ArgumentError, 'name keyword argument is required'
8
+ @name, @from, @to, @added = name, from, to, added
9
+ end
10
+
11
+ attr_reader :name # Name of the changed field.
12
+
13
+ attr_reader :from # Original value from which the field was changed.
14
+
15
+ attr_reader :to # New value to which the field was changed.
16
+
17
+ # Returns true if the field was newly added with this change.
18
+ def added?
19
+ !!@added
20
+ end
21
+
22
+ # Returns a string representation of this change. A change from=nil* is an
23
+ # addition change as opposed to a regular change from some previous value.
24
+ def to_s
25
+ "<#{self.class} name=#{@name.inspect} from=#{@from.inspect}#{?* if @added} to=#{@to.inspect}>"
26
+ end
27
+
28
+ alias inspect to_s
29
+
30
+ module Support
31
+ extend Tins::Concern
32
+
33
+ included do
34
+ singleton_class.class_eval do
35
+ extend Tins::ThreadLocal
36
+ thread_local :ignore_changesp
37
+ end
38
+ end
39
+
40
+ # Record the change to +new_value+ for the field +name+.
41
+ def record_change(name, new_value)
42
+ old_value = self[name]
43
+ if old_value != new_value
44
+ @changes << Fakery::Change.new(
45
+ name: name,
46
+ from: old_value,
47
+ to: new_value,
48
+ added: !table.key?(name)
49
+ )
50
+ end
51
+ self
52
+ end
53
+
54
+ module ClassMethods
55
+ # Return true iff in ignoring changes mode.
56
+ def ignore_changes?
57
+ ignore_changesp
58
+ end
59
+
60
+ # Ignore the changes during execution of the yielded block.
61
+ def ignore_changes
62
+ old, self.ignore_changesp = ignore_changesp, true
63
+ yield
64
+ ensure
65
+ self.ignore_changesp = old
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,106 @@
1
+ class Fakery::Fake < JSON::GenericObject
2
+ include Fakery::Change::Support
3
+
4
+ class << self
5
+ def cast(fake)
6
+ case
7
+ when self === fake
8
+ fake
9
+ when Fakery.registered?(fake)
10
+ Fakery.build(fake)
11
+ when fake.respond_to?(:to_hash)
12
+ from_hash(fake.to_hash)
13
+ when fake.respond_to?(:read)
14
+ cast(fake.read)
15
+ when fake.respond_to?(:to_str)
16
+ from_json(fake.to_str)
17
+ when fake.respond_to?(:as_json)
18
+ from_hash(fake.as_json)
19
+ else
20
+ raise ArgumentError, "cannot cast #{fake.inspect}"
21
+ end
22
+ end
23
+
24
+ def from_hash(*a, &b)
25
+ ignore_changes { super }
26
+ end
27
+
28
+ def from_json(json)
29
+ JSON.parse(json, object_class: self)
30
+ end
31
+
32
+ def seed_from_url(api_seed_url)
33
+ ignore_changes do
34
+ new.tap do |obj|
35
+ obj.__api_seed_url__ = api_seed_url
36
+ end.__send__(:reseed)
37
+ end
38
+ end
39
+ end
40
+
41
+ def initialize(*)
42
+ super
43
+ @changes = Set[]
44
+ end
45
+
46
+ def as_json(*)
47
+ to_hash
48
+ end
49
+
50
+ private
51
+
52
+ attr_reader :changes
53
+
54
+ def http_response(type: :typhoeus, http_status: 200)
55
+ ::Typhoeus::Response.new(code: http_status, body: JSON(self)).tap do |r|
56
+ r.ask_and_send(:mock=, true)
57
+ end
58
+ end
59
+
60
+ def reseed
61
+ myself = self
62
+ self.class.from_hash(Fakery::Api.get(__api_seed_url__)).instance_eval do
63
+ self.__api_seed_url__ = myself.__api_seed_url__
64
+ for (name, value) in table
65
+ myself[name] = value
66
+ end
67
+ end
68
+ myself
69
+ end
70
+
71
+ def register_as_ruby(register_name)
72
+ register_name = register_name.to_sym
73
+ result = <<EOT
74
+ Fakery.register(#{register_name.inspect}, %{
75
+ #{JSON.pretty_generate(self).gsub(/^/, ' ')}
76
+ })
77
+ EOT
78
+ end
79
+
80
+ def initialize_copy(other)
81
+ other.instance_variable_set :@changes, @changes.dup
82
+ super
83
+ end
84
+
85
+ def new_ostruct_member(name)
86
+ name = name.to_sym
87
+ # Let's not define any singleton methods for write accessors
88
+ if name !~ /=\z/
89
+ define_singleton_method(name) { @table[name] }
90
+ end
91
+ name
92
+ end
93
+
94
+ def method_missing(id, *args, &block)
95
+ if id =~ /=\z/
96
+ args.size > 1 and
97
+ raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
98
+ name = $`.to_sym
99
+ value = args.first
100
+ self.class.ignore_changes? or record_change(name, value)
101
+ modifiable[name] = value
102
+ else
103
+ super
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,2 @@
1
+ class Fakery::FakeryError < StandardError
2
+ end
@@ -0,0 +1,50 @@
1
+ module Fakery::Registry
2
+ module_function
3
+
4
+ def registered_fakes
5
+ @registered_fakes ||= {}
6
+ end
7
+ private :registered_fakes
8
+
9
+ # Clear all registered fakes.
10
+ def clear
11
+ registered_fakes.clear
12
+ end
13
+
14
+ # Returns true, if there is a fake registered under name +name+.
15
+ def registered?(name)
16
+ name.respond_to?(:to_sym) && registered_fakes.key?(name.to_sym)
17
+ end
18
+
19
+ # Registers +fake+ under name +register_name. (A fake is either a
20
+ # Fakery::Fake instance or a string containing a JSON representation to be
21
+ # faked. If a fake was already registered under this name a warning will be
22
+ # displayed.
23
+ def register(register_name, fake)
24
+ register_name = register_name.to_sym
25
+ if registered?(register_name)
26
+ warn "WARNING: Overwriting a fake for an already registered name #{register_name.inspect}."
27
+ end
28
+ registered_fakes[register_name] = Fakery::Fake.cast(fake)
29
+ end
30
+
31
+ # Builds a the fake registered under the name +register_name+. All its fields
32
+ # can be changed according to the names and values in the +with+ keyword
33
+ # argument or later by using setters on the object.
34
+ def build(register_name, with: {})
35
+ register_name = register_name.to_sym
36
+ fake = registered_fakes.fetch(register_name).dup
37
+ for (name, value) in with
38
+ fake[name] = value
39
+ end
40
+ fake
41
+ rescue KeyError
42
+ raise ArgumentError, "no fake registered under the name #{register_name.inspect}"
43
+ end
44
+
45
+ # Returns the ruby source to register +fake+ under the +name+.
46
+ def source(name, fake)
47
+ fake = Fakery::Fake.cast(fake)
48
+ fake.__send__(:register_as_ruby, name)
49
+ end
50
+ end
@@ -0,0 +1,14 @@
1
+ module Fakery::Seeding
2
+ module_function
3
+
4
+ # TODO
5
+ def seed(api_seed_url)
6
+ Fakery::Fake.seed_from_url(api_seed_url)
7
+ end
8
+
9
+ # TODO
10
+ def reseed(fake, url = nil)
11
+ url and fake.__api_seed_url__ = url
12
+ fake.__send__(:reseed)
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ module Fakery
2
+ # Fakery version
3
+ VERSION = '0.1.0'
4
+ VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
8
+ end
@@ -0,0 +1,18 @@
1
+ module Fakery::Wrapping
2
+ module_function
3
+
4
+ # Return a mocked HTTP response that contains the JSON representation of
5
+ # +fake+ in its body. This response has the status code +http_status+.
6
+ def http_response(fake, type: :typhoeus, http_status: 200)
7
+ fake = Fakery::Fake.cast(fake)
8
+ fake.__send__(:http_response, type: :typhoeus, http_status: http_status)
9
+ end
10
+
11
+ # Return an instance of class +as+ initialized with the hash representation
12
+ # of +fake+ (via its constructor).
13
+ def instance(fake, as: nil) # TODO remove nil in Ruby 2.1
14
+ as or raise ArgumentError, 'as keyword argument is required'
15
+ fake = Fakery::Fake.cast(fake)
16
+ as.new(fake.to_hash)
17
+ end
18
+ end
data/spec/api_spec.rb ADDED
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fakery::Api do
4
+ context JSON::ParserError do
5
+ before do
6
+ Typhoeus.stub(/.*/).and_return Typhoeus::Response.new(
7
+ code: 200, body: '<nix>json</nix>'
8
+ )
9
+ end
10
+
11
+ it 'wraps it into a Fakery::ApiError' do
12
+ expect { Fakery::Api.get('http://foo.bar') }.to raise_error Fakery::ApiError
13
+ end
14
+
15
+ it 'has a sensible message' do
16
+ e = Fakery::Api.get('http://foo.bar') rescue $!
17
+ expect(e.message).to match "JSON::ParserError"
18
+ expect(e.message).to match "unexpected token at '<nix>json</nix>'"
19
+ end
20
+ end
21
+
22
+ context 'unsuccessful response' do
23
+ before do
24
+ response = Typhoeus::Response.new(
25
+ code: 404, body: '{ "dont": "matter" }'
26
+ )
27
+ allow(response).to receive(:return_message).and_return('curl describes the problem a bit more')
28
+ Typhoeus.stub(/.*/).and_return response
29
+ end
30
+
31
+
32
+ it 'should raise a Fakery::ApiError' do
33
+ expect { Fakery::Api.get('http://foo.bar') }.to raise_error Fakery::ApiError
34
+ end
35
+
36
+ it 'has a sensible message' do
37
+ e = Fakery::Api.get('http://foo.bar') rescue $!
38
+ expect(e.message).to match "api responded with http_status=404 "
39
+ expect(e.message).to match 'curl describes the problem a bit more'
40
+ end
41
+ end
42
+ end
43
+
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fakery::Change do
4
+ it 'raises ArgumentError if arguments are missing' do
5
+ expect { Fakery::Change.new }.to raise_error ArgumentError
6
+ end
7
+
8
+ context 'regular change' do
9
+ let :change do
10
+ Fakery::Change.new(name: 'foo', from: nil, to: 23)
11
+ end
12
+
13
+ it 'has nice string representations' do
14
+ expect(change.to_s).to eq change.inspect
15
+ end
16
+
17
+ it 'supports changes of fields' do
18
+ expect(change.from).to be_nil
19
+ expect(change.to).to eq 23
20
+ expect(change).to_not be_added
21
+ end
22
+ end
23
+
24
+
25
+ context 'addition change' do
26
+ let :change do
27
+ Fakery::Change.new(name: 'foo', from: nil, to: 23, added: true)
28
+ end
29
+
30
+ it 'has nice string representations' do
31
+ expect(change.to_s).to eq change.inspect
32
+ end
33
+
34
+ it 'supports changes of fields' do
35
+ expect(change.from).to be_nil
36
+ expect(change.to).to eq 23
37
+ expect(change).to be_added
38
+ end
39
+ end
40
+ end
data/spec/fake_spec.rb ADDED
@@ -0,0 +1,98 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ describe Fakery::Fake do
5
+ let! :fake do
6
+ fake = Fakery::Fake.from_hash(name: 'foo')
7
+ Fakery.register(:foo, fake)
8
+ fake
9
+ end
10
+
11
+ context Fakery::Change do
12
+ it 'records regular changes' do
13
+ obj = Fakery.build(:foo)
14
+ expect(obj.__send__(:changes)).to be_empty
15
+ obj.name = 'bar'
16
+ expect(obj.__send__(:changes).size).to eq 1
17
+ change = obj.__send__(:changes).first
18
+ expect(change.name).to eq :name
19
+ expect(change.from).to eq 'foo'
20
+ expect(change.to).to eq 'bar'
21
+ expect(change).to_not be_added
22
+ end
23
+
24
+ it 'records addition changes' do
25
+ obj = Fakery.build(:foo)
26
+ expect(obj.__send__(:changes)).to be_empty
27
+ obj.change = true
28
+ expect(obj.__send__(:changes).size).to eq 1
29
+ change = obj.__send__(:changes).first
30
+ expect(change.name).to eq :change
31
+ expect(change.from).to be_nil
32
+ expect(change.to).to eq true
33
+ expect(change).to be_added
34
+ end
35
+
36
+ it 'can ignore changes' do
37
+ obj = Fakery.build(:foo)
38
+ expect(obj.__send__(:changes)).to be_empty
39
+ Fakery::Fake.ignore_changes do
40
+ obj.change = true
41
+ end
42
+ expect(obj.__send__(:changes)).to be_empty
43
+ end
44
+ end
45
+
46
+ it 'can be generated from a JSON text' do
47
+ fake = Fakery::Fake.from_json '{ "name": "foo" }'
48
+ expect(fake).to be_a Fakery::Fake
49
+ expect(fake.name).to eq 'foo'
50
+ end
51
+
52
+ it 'can output ruby code for registration in the Fake::Registry' do
53
+ string = Fakery.source(:my_name, fake)
54
+ expect(string).to be_a String
55
+ expect(Fakery).to_not be_registered :my_name
56
+ eval(string)
57
+ expect(Fakery).to be_registered :my_name
58
+ expect(Fakery.build(:my_name).name).to eq 'foo'
59
+ end
60
+
61
+ context 'casting' do
62
+ it 'casts to itself' do
63
+ casted = Fakery::Fake.cast(fake)
64
+ expect(casted).to be_a Fakery::Fake
65
+ expect(casted.name).to eq 'foo'
66
+ end
67
+
68
+ it 'casts from a name to a registered fake' do
69
+ Fakery.register(:foo, fake)
70
+ casted = Fakery::Fake.cast(:foo)
71
+ expect(casted).to be_a Fakery::Fake
72
+ expect(casted.name).to eq 'foo'
73
+ end
74
+
75
+ it 'casts from a hash to a fake' do
76
+ casted = Fakery::Fake.cast(name: 'foo')
77
+ expect(casted).to be_a Fakery::Fake
78
+ expect(casted.name).to eq 'foo'
79
+ end
80
+
81
+ it 'casts from a json text to a fake' do
82
+ casted = Fakery::Fake.cast('{ "name": "foo" }')
83
+ expect(casted).to be_a Fakery::Fake
84
+ expect(casted.name).to eq 'foo'
85
+ end
86
+
87
+ it 'casts from a file containing json text to a fake' do
88
+ io = StringIO.new << '{ "name": "foo" }'
89
+ fake = Fakery::Fake.cast(io.tap(&:rewind))
90
+ expect(fake).to be_a Fakery::Fake
91
+ expect(fake.name).to eq 'foo'
92
+ end
93
+
94
+ it 'raises an ArgumentError if it cannot cast' do
95
+ expect { Fakery::Fake.cast(Object.new) }.to raise_error ArgumentError
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fakery::Registry do
4
+ let :fake do
5
+ Fakery::Fake.from_hash(name: 'foo')
6
+ end
7
+
8
+ it 'registers fakes under a name' do
9
+ expect(Fakery).to_not be_registered 'foo'
10
+ expect(Fakery).to_not be_registered :foo
11
+ Fakery.register 'foo', fake
12
+ expect(Fakery).to be_registered 'foo'
13
+ expect(Fakery).to be_registered :foo
14
+ end
15
+
16
+ it 'warns iff a fake was registered a second time' do
17
+ expect(Fakery::Registry).to receive(:warn).with(any_args).and_call_original
18
+ Fakery.register 'foo', fake
19
+ Fakery.register 'foo', fake
20
+ end
21
+
22
+ context 'registered fake' do
23
+ before :each do
24
+ Fakery.register :foo, fake
25
+ end
26
+
27
+ it 'cannot be built if not registered' do
28
+ expect { Fakery.build(:bar) }.to raise_error ArgumentError
29
+ end
30
+
31
+ it 'can be built' do
32
+ foo = Fakery.build(:foo)
33
+ expect(foo.name).to eq 'foo'
34
+ expect(foo.bar).to be_nil
35
+ end
36
+
37
+ it 'can be changed and registered again' do
38
+ foo = Fakery.build(:foo, with: { bar: true })
39
+ expect(foo.bar).to eq true
40
+ Fakery.register(:bar, foo)
41
+ expect(Fakery.build(:bar).bar).to eq true
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fakery::Seeding do
4
+ let :fake do
5
+ Fakery::Fake.from_hash(name: 'foo')
6
+ end
7
+
8
+ it 'can be seeded from an URL' do
9
+ url = 'http://api.some.where/foo.json'
10
+ another_fake = fake.dup
11
+ another_fake.name = 'bar'
12
+ expect(Fakery::Api).to receive(:get).and_return(another_fake)
13
+ fake = Fakery.seed url
14
+ expect(fake.name).to eq another_fake.name
15
+ expect(fake.__api_seed_url__).to eq url
16
+ end
17
+
18
+ it 'can be reseeded from an URL' do
19
+ url = 'http://api.some.where/foo.json'
20
+ another_fake = fake.dup
21
+ another_fake.name = 'bar'
22
+ fake.__api_seed_url__ = url
23
+ expect(Fakery::Api).to receive(:get).and_return(another_fake)
24
+ Fakery.reseed(fake)
25
+ expect(fake.name).to eq another_fake.name
26
+ expect(fake.__api_seed_url__).to eq url
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ require 'simplecov'
2
+ require "codeclimate-test-reporter"
3
+ if ENV['START_SIMPLECOV'].to_i == 1
4
+ SimpleCov.start do
5
+ add_filter "#{File.basename(File.dirname(__FILE__))}/"
6
+ end
7
+ end
8
+ if ENV['CODECLIMATE_REPO_TOKEN']
9
+ if ENV['START_SIMPLECOV']
10
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
11
+ SimpleCov::Formatter::HTMLFormatter,
12
+ CodeClimate::TestReporter::Formatter
13
+ ]
14
+ end
15
+ CodeClimate::TestReporter.start
16
+ end
17
+ require 'rspec'
18
+ require 'byebug'
19
+ require 'fakery'
20
+
21
+ RSpec.configure do |config|
22
+ config.before(:each) do
23
+ Typhoeus::Config.block_connection = true
24
+ end
25
+
26
+ config.after(:each) do
27
+ Typhoeus::Expectation.clear
28
+ Fakery::Registry.clear
29
+ end
30
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe Fakery::Wrapping do
4
+ let :fake do
5
+ Fakery::Fake.from_hash(name: 'foo')
6
+ end
7
+
8
+ describe 'http_response' do
9
+ context Typhoeus do
10
+ it 'returns a successful http response object' do
11
+ response = Fakery.http_response(fake)
12
+ expect(response).to be_success
13
+ expect(JSON(response.body)['name']).to eq fake.name
14
+ end
15
+
16
+ it 'returns an unsuccessful http response object' do
17
+ response = Fakery.http_response(fake, http_status: 500)
18
+ expect(response).to_not be_success
19
+ expect(JSON(response.body)['name']).to eq fake.name
20
+ end
21
+
22
+ context 'registered' do
23
+ before :each do
24
+ Fakery.register :foo, fake
25
+ end
26
+
27
+ it 'returns a http response object' do
28
+ response = Fakery.http_response(:foo)
29
+ expect(JSON(response.body)['name']).to eq fake.name
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ describe 'instance' do
36
+ let :klass do
37
+ Class.new do
38
+ def initialize(attrs)
39
+ @attrs = attrs
40
+ end
41
+
42
+ attr_reader :attrs
43
+ end
44
+ end
45
+
46
+ it 'returns an instance' do
47
+ obj = Fakery.instance(fake, as: klass)
48
+ expect(obj.attrs[:name]).to eq fake.name
49
+ end
50
+
51
+ context 'registered' do
52
+ before :each do
53
+ Fakery.register :foo, fake
54
+ end
55
+
56
+ it 'returns an instance' do
57
+ obj = Fakery.instance(:foo, as: klass)
58
+ expect(obj.attrs[:name]).to eq fake.name
59
+ end
60
+ end
61
+ end
62
+ end
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fakery
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - betterplace Developers
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gem_hadar
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: tins
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: term-ansicolor
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: typhoeus
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: json
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.0'
139
+ description: This library fakes ruby objects from JSON API responses for testing purposes.
140
+ email: developers@betterplace.org
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files:
144
+ - README.md
145
+ - lib/fakery.rb
146
+ - lib/fakery/api.rb
147
+ - lib/fakery/api_error.rb
148
+ - lib/fakery/change.rb
149
+ - lib/fakery/fake.rb
150
+ - lib/fakery/fakery_error.rb
151
+ - lib/fakery/registry.rb
152
+ - lib/fakery/seeding.rb
153
+ - lib/fakery/version.rb
154
+ - lib/fakery/wrapping.rb
155
+ files:
156
+ - ".gitignore"
157
+ - ".rspec"
158
+ - ".travis.yml"
159
+ - Gemfile
160
+ - LICENSE
161
+ - README.md
162
+ - Rakefile
163
+ - TODO.md
164
+ - VERSION
165
+ - fakery.gemspec
166
+ - lib/fakery.rb
167
+ - lib/fakery/api.rb
168
+ - lib/fakery/api_error.rb
169
+ - lib/fakery/change.rb
170
+ - lib/fakery/fake.rb
171
+ - lib/fakery/fakery_error.rb
172
+ - lib/fakery/registry.rb
173
+ - lib/fakery/seeding.rb
174
+ - lib/fakery/version.rb
175
+ - lib/fakery/wrapping.rb
176
+ - spec/api_spec.rb
177
+ - spec/change_spec.rb
178
+ - spec/fake_spec.rb
179
+ - spec/registry_spec.rb
180
+ - spec/seeding_spec.rb
181
+ - spec/spec_helper.rb
182
+ - spec/wrapping_spec.rb
183
+ homepage: http://github.com/betterplace/fakery
184
+ licenses: []
185
+ metadata: {}
186
+ post_install_message:
187
+ rdoc_options:
188
+ - "--title"
189
+ - 'Fakery -- '
190
+ - "--main"
191
+ - README.md
192
+ require_paths:
193
+ - lib
194
+ required_ruby_version: !ruby/object:Gem::Requirement
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: '0'
199
+ required_rubygems_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ requirements: []
205
+ rubyforge_project:
206
+ rubygems_version: 2.5.1
207
+ signing_key:
208
+ specification_version: 4
209
+ summary: Fake Ruby objects from JSON API responses
210
+ test_files:
211
+ - spec/api_spec.rb
212
+ - spec/change_spec.rb
213
+ - spec/fake_spec.rb
214
+ - spec/registry_spec.rb
215
+ - spec/seeding_spec.rb
216
+ - spec/spec_helper.rb
217
+ - spec/wrapping_spec.rb