fakery 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/fakery.gemspec +3 -3
- data/lib/fakery/change.rb +1 -1
- data/lib/fakery/version.rb +1 -1
- data/lib/fakery/wrapping.rb +2 -1
- data/spec/wrapping_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc188f39d30e86ae661ade53a2c14d8bf55e3ff
|
4
|
+
data.tar.gz: d365ddbe995a8212d6ca3892966c56f19a6b491c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0869138fda5b663cb23068f60dca01c309e50ee6ff7a7662fe1a239f384e9111b6d882ce57475fbae7f6819bffa82baf27f2599c64714123016f8c3fdf5b067c
|
7
|
+
data.tar.gz: b9b5a77c1550bacd46c45177de1d9a3d22b1648d1dc454c2a0161d7c101e2a264b6be79bb0287c6c32b7aaad49bddfc19572830c3aea39c7a12d4d2a4ca89aa4
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ GemHadar do
|
|
12
12
|
test_dir 'spec'
|
13
13
|
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
|
14
14
|
'.ruby-version', '.AppleDouble', 'tags', '.DS_Store', '.utilsrc', 'doc',
|
15
|
-
'errors.lst'
|
15
|
+
'errors.lst', '.byebug_history'
|
16
16
|
readme 'README.md'
|
17
17
|
title "#{name.camelize} -- "
|
18
18
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/fakery.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: fakery 0.
|
2
|
+
# stub: fakery 0.3.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fakery"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.3.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["betterplace Developers"]
|
11
|
-
s.date = "2016-
|
11
|
+
s.date = "2016-06-01"
|
12
12
|
s.description = "This library fakes ruby objects from JSON API responses for testing purposes."
|
13
13
|
s.email = "developers@betterplace.org"
|
14
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"]
|
data/lib/fakery/change.rb
CHANGED
@@ -3,7 +3,7 @@ class Fakery::Change
|
|
3
3
|
# which the field was changed. +to+ is the new value to which the field was
|
4
4
|
# changed. If +added+ is false (default) this is a change from previously set
|
5
5
|
# value, if it's true then this change is a new addition of a field.
|
6
|
-
def initialize(name
|
6
|
+
def initialize(name:, from:, to:, added: false)
|
7
7
|
name or raise ArgumentError, 'name keyword argument is required'
|
8
8
|
@name, @from, @to, @added = name, from, to, added
|
9
9
|
end
|
data/lib/fakery/version.rb
CHANGED
data/lib/fakery/wrapping.rb
CHANGED
@@ -10,9 +10,10 @@ module Fakery::Wrapping
|
|
10
10
|
|
11
11
|
# Return an instance of class +as+ initialized with the hash representation
|
12
12
|
# of +fake+ (via its constructor).
|
13
|
-
def instance(fake, as: nil)
|
13
|
+
def instance(fake, as:, with: nil)
|
14
14
|
as or raise ArgumentError, 'as keyword argument is required'
|
15
15
|
fake = Fakery::Fake.cast(fake)
|
16
|
+
with and fake = Fakery::Fake.cast(fake.to_hash.merge(with))
|
16
17
|
as.new(fake.to_hash)
|
17
18
|
end
|
18
19
|
end
|
data/spec/wrapping_spec.rb
CHANGED
@@ -57,6 +57,11 @@ describe Fakery::Wrapping do
|
|
57
57
|
obj = Fakery.instance(:foo, as: klass)
|
58
58
|
expect(obj.attrs[:name]).to eq fake.name
|
59
59
|
end
|
60
|
+
|
61
|
+
it 'returns a modified instance' do
|
62
|
+
obj = Fakery.instance(:foo, as: klass, with: { name: 'bar' })
|
63
|
+
expect(obj.attrs[:name]).to eq 'bar'
|
64
|
+
end
|
60
65
|
end
|
61
66
|
end
|
62
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fakery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- betterplace Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|