remote_factory_girl 1.0.1 → 1.0.2
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 +4 -4
- data/.rspec +0 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -1
- data/README.md +7 -2
- data/lib/remote_factory_girl/version.rb +1 -1
- data/spec/integration/remote_factory_girl_spec.rb +8 -8
- data/spec/models/remote_factory_girl/config_applier_spec.rb +7 -7
- data/spec/models/remote_factory_girl/config_spec.rb +6 -6
- data/spec/models/remote_factory_girl/http_spec.rb +2 -2
- data/spec/models/remote_factory_girl_spec.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 568879d0cb0a73b0a0b4cfbc8d24a7e55db06052
|
4
|
+
data.tar.gz: 050ebe624b42a226271972e4174d635750a1b998
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9105b90699050925579b0e0dc4fd9b7af917f6c6073b1f90798ab9c9ac030627b12f5d7169adf05677b984e8cdc0541a8ffb1af3c1923fac5a0f1f789d2311
|
7
|
+
data.tar.gz: 6d1c20f5438cb6eebdb16f019415843c628ff4c43267c9c85a422e1f55eb27521fb2bc9a407ea5f3bb62482070b477598127a91fa854074c04ffab9709af5f92
|
data/.rspec
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RemoteFactoryGirl
|
2
2
|
|
3
|
-
[factory_girl](https://github.com/thoughtbot/factory_girl) for [Service Oriented Architecture](http://en.wikipedia.org/wiki/Service-oriented_architecture) (SOA). Create [factory_girl](https://github.com/thoughtbot/factory_girl)
|
3
|
+
[factory_girl](https://github.com/thoughtbot/factory_girl) for [Service Oriented Architecture](http://en.wikipedia.org/wiki/Service-oriented_architecture) (SOA). Create test data with [factory_girl](https://github.com/thoughtbot/factory_girl) remotely when used in conjunction with [remote_factory_girl_home_rails](https://github.com/tdouce/remote_factory_girl_home_rails).
|
4
4
|
|
5
5
|
## Getting Started
|
6
6
|
|
@@ -14,8 +14,13 @@ See [GETTING_STARTED](https://github.com/tdouce/remote_factory_girl/wiki/Getting
|
|
14
14
|
|
15
15
|
## Contributing
|
16
16
|
|
17
|
-
1. Fork it ( http://github.com
|
17
|
+
1. Fork it ( http://github.com/tdouce/remote_factory_girl/fork )
|
18
18
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
19
19
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
20
20
|
4. Push to the branch (`git push origin my-new-feature`)
|
21
21
|
5. Create new Pull Request
|
22
|
+
|
23
|
+
## TODOS
|
24
|
+
|
25
|
+
1. Allow remote_factory_girl to configure multiple "homes" (external services) so that
|
26
|
+
remote_factory_girl can create test data in multiple "homes"s.
|
@@ -10,9 +10,9 @@ describe RemoteFactoryGirl do
|
|
10
10
|
:port => nil,
|
11
11
|
:end_point => '/remote_factory_girl/home'})
|
12
12
|
expect(RemoteFactoryGirl.config.return_response_as).to eq(:as_hash)
|
13
|
-
expect(RemoteFactoryGirl.config.return_with_root).to
|
14
|
-
expect(RemoteFactoryGirl.config.return_as_active_resource).to
|
15
|
-
expect(RemoteFactoryGirl.config.https).to
|
13
|
+
expect(RemoteFactoryGirl.config.return_with_root).to eq true
|
14
|
+
expect(RemoteFactoryGirl.config.return_as_active_resource).to eq false
|
15
|
+
expect(RemoteFactoryGirl.config.https).to eq false
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should be able to configure with a block' do
|
@@ -37,17 +37,17 @@ describe RemoteFactoryGirl do
|
|
37
37
|
|
38
38
|
it 'should be able to configure .return_with_root' do
|
39
39
|
RemoteFactoryGirl.config.return_with_root = false
|
40
|
-
expect(RemoteFactoryGirl.config.return_with_root).to
|
40
|
+
expect(RemoteFactoryGirl.config.return_with_root).to eq false
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should be able to configure .return_as_active_resource' do
|
44
44
|
RemoteFactoryGirl.config.return_as_active_resource = true
|
45
|
-
expect(RemoteFactoryGirl.config.return_as_active_resource).to
|
45
|
+
expect(RemoteFactoryGirl.config.return_as_active_resource).to eq true
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should be able to configure https' do
|
49
49
|
RemoteFactoryGirl.config.https = true
|
50
|
-
expect(RemoteFactoryGirl.config.https).to
|
50
|
+
expect(RemoteFactoryGirl.config.https).to eq true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -66,8 +66,8 @@ describe RemoteFactoryGirl do
|
|
66
66
|
describe 'creating a remote factory' do
|
67
67
|
|
68
68
|
before do
|
69
|
-
RestClient.
|
70
|
-
RestClient.
|
69
|
+
allow(RestClient).to receive(:post).and_return('{"user": {"id": "1", "first_name": "Sam", "last_name": "Iam"}}')
|
70
|
+
allow(RestClient).to receive(:get).and_return('["user", "user_admin"]')
|
71
71
|
end
|
72
72
|
|
73
73
|
describe '.factories' do
|
@@ -5,7 +5,7 @@ require 'ostruct'
|
|
5
5
|
describe RemoteFactoryGirl::ConfigApplier do
|
6
6
|
|
7
7
|
describe '.post' do
|
8
|
-
let(:json) {
|
8
|
+
let(:json) {
|
9
9
|
{ :user => { :first_name => "Sam", :last_name => "Iam"}}
|
10
10
|
}
|
11
11
|
let(:hash_to_dot_klass) { double('RemoteFactoryGirl::HashToDot') }
|
@@ -42,20 +42,20 @@ describe RemoteFactoryGirl::ConfigApplier do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should return an object that responds to dot notation' do
|
45
|
-
hash_to_dot_klass.
|
45
|
+
allow(hash_to_dot_klass).to receive(:convert).and_return(dish_json_with_user)
|
46
46
|
response = RemoteFactoryGirl::ConfigApplier.apply_config(json, :return_response_as => :dot_notation,
|
47
47
|
:hash_to_dot_klass => hash_to_dot_klass)
|
48
|
-
expect(response.user.first_name).to eq('Sam')
|
48
|
+
expect(response.user.first_name).to eq('Sam')
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should not return root hash key and should return an object that responds to dot notation' do
|
52
52
|
factory_girl_json_parser = double('RemoteFactoryGirl::FactoryGirlJsonParser', without_root: { :first_name => 'Sam', :last_name => 'Iam'})
|
53
|
-
hash_to_dot_klass.
|
54
|
-
response = RemoteFactoryGirl::ConfigApplier.apply_config(json, :return_response_as => :dot_notation,
|
53
|
+
allow(hash_to_dot_klass).to receive(:convert).and_return(dot_notation_without_root)
|
54
|
+
response = RemoteFactoryGirl::ConfigApplier.apply_config(json, :return_response_as => :dot_notation,
|
55
55
|
:return_with_root => false,
|
56
56
|
:hash_to_dot_klass => hash_to_dot_klass,
|
57
57
|
:factory_girl_json_parser => factory_girl_json_parser)
|
58
|
-
expect(response.first_name).to eq('Sam')
|
58
|
+
expect(response.first_name).to eq('Sam')
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -63,7 +63,7 @@ describe RemoteFactoryGirl::ConfigApplier do
|
|
63
63
|
it 'should return an active resource object' do
|
64
64
|
json_to_active_resource_klass = double('RemoteFactoryGirl::JsonToActiveResource')
|
65
65
|
expect(json_to_active_resource_klass).to receive(:convert).with(json)
|
66
|
-
RemoteFactoryGirl::ConfigApplier.apply_config(json, :return_as_active_resource => true,
|
66
|
+
RemoteFactoryGirl::ConfigApplier.apply_config(json, :return_as_active_resource => true,
|
67
67
|
:json_to_active_resource_klass => json_to_active_resource_klass)
|
68
68
|
end
|
69
69
|
end
|
@@ -15,9 +15,9 @@ describe RemoteFactoryGirl::Config do
|
|
15
15
|
:port => nil,
|
16
16
|
:end_point => '/remote_factory_girl/home'})
|
17
17
|
expect(config.return_response_as).to eq(:as_hash)
|
18
|
-
expect(config.return_with_root).to
|
19
|
-
expect(config.return_as_active_resource).to
|
20
|
-
expect(config.https).to
|
18
|
+
expect(config.return_with_root).to eq true
|
19
|
+
expect(config.return_as_active_resource).to eq false
|
20
|
+
expect(config.https).to eq false
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -49,17 +49,17 @@ describe RemoteFactoryGirl::Config do
|
|
49
49
|
it 'should return false when host and end_point are not set' do
|
50
50
|
config.home[:host] = nil
|
51
51
|
config.home[:end_point] = nil
|
52
|
-
expect(config.has_home?).to
|
52
|
+
expect(config.has_home?).to eq false
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'should return false when host is not set and end_point is set' do
|
56
|
-
expect(config.has_home?).to
|
56
|
+
expect(config.has_home?).to eq false
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should return true when host and end_point is set' do
|
60
60
|
config.home[:host] = 'localhost'
|
61
61
|
config.home[:end_point] = 'some_where'
|
62
|
-
expect(config.has_home?).to
|
62
|
+
expect(config.has_home?).to eq true
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -9,14 +9,14 @@ describe RemoteFactoryGirl::Http do
|
|
9
9
|
let(:rest_client) { double('RestClient') }
|
10
10
|
|
11
11
|
it 'should raise no host config errors' do
|
12
|
-
rest_client.stub(:post).with(config.home_url, params, content_type: :json, accept: :json).and_return(true)
|
13
12
|
expect(config).to receive(:raise_if_host_not_set)
|
13
|
+
allow(rest_client).to receive(:post).with(config.home_url, params, content_type: :json, accept: :json).and_return(true)
|
14
14
|
RemoteFactoryGirl::Http.post(config, params, rest_client)
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'should send http request to home_url with params' do
|
18
|
-
config.stub(:raise_if_host_not_set)
|
19
18
|
expect(rest_client).to receive(:post).with(config.home_url, params, content_type: :json, accept: :json)
|
19
|
+
allow(config).to receive(:raise_if_host_not_set)
|
20
20
|
RemoteFactoryGirl::Http.post(config, params, rest_client)
|
21
21
|
end
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_factory_girl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tdouce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- ".gitignore"
|
77
77
|
- ".rspec"
|
78
|
+
- CHANGELOG.md
|
78
79
|
- Gemfile
|
79
80
|
- LICENSE.txt
|
80
81
|
- README.md
|