factory_girl-remote_api 0.3.0
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.
- data/MIT-LICENSE +20 -0
- data/README.md +168 -0
- data/Rakefile +58 -0
- data/app/assets/javascripts/factory_girl-remote_api/application.js +13 -0
- data/app/assets/stylesheets/factory_girl-remote_api/application.css +13 -0
- data/app/controllers/factory_girl/remote_api/application_controller.rb +6 -0
- data/app/controllers/factory_girl/remote_api/factories_controller.rb +24 -0
- data/app/helpers/factory_girl/remote_api/application_helper.rb +4 -0
- data/app/views/layouts/factory_girl/remote_api/application.html.erb +14 -0
- data/config/routes.rb +4 -0
- data/lib/factory_girl/remote_api/configuration.rb +21 -0
- data/lib/factory_girl/remote_api/engine.rb +14 -0
- data/lib/factory_girl/remote_api/remote_factory.rb +31 -0
- data/lib/factory_girl/remote_api/request.rb +40 -0
- data/lib/factory_girl/remote_api/version.rb +5 -0
- data/lib/factory_girl/remote_api.rb +35 -0
- data/spec/dummy_31/Rakefile +7 -0
- data/spec/dummy_31/app/assets/javascripts/application.js +9 -0
- data/spec/dummy_31/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy_31/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_31/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_31/app/models/user.rb +3 -0
- data/spec/dummy_31/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_31/config/application.rb +45 -0
- data/spec/dummy_31/config/boot.rb +10 -0
- data/spec/dummy_31/config/database.yml +25 -0
- data/spec/dummy_31/config/environment.rb +5 -0
- data/spec/dummy_31/config/environments/development.rb +30 -0
- data/spec/dummy_31/config/environments/production.rb +60 -0
- data/spec/dummy_31/config/environments/test.rb +39 -0
- data/spec/dummy_31/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_31/config/initializers/inflections.rb +10 -0
- data/spec/dummy_31/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_31/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_31/config/initializers/session_store.rb +8 -0
- data/spec/dummy_31/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_31/config/locales/en.yml +5 -0
- data/spec/dummy_31/config/routes.rb +3 -0
- data/spec/dummy_31/config.ru +4 -0
- data/spec/dummy_31/db/development.sqlite3 +0 -0
- data/spec/dummy_31/db/migrate/20130607202020_create_users.rb +10 -0
- data/spec/dummy_31/db/schema.rb +23 -0
- data/spec/dummy_31/db/test.sqlite3 +0 -0
- data/spec/dummy_31/log/test.log +130 -0
- data/spec/dummy_31/public/404.html +26 -0
- data/spec/dummy_31/public/422.html +26 -0
- data/spec/dummy_31/public/500.html +26 -0
- data/spec/dummy_31/public/favicon.ico +0 -0
- data/spec/dummy_31/script/rails +6 -0
- data/spec/dummy_31/spec/factories/users.rb +13 -0
- data/spec/dummy_32/README.rdoc +261 -0
- data/spec/dummy_32/Rakefile +7 -0
- data/spec/dummy_32/app/assets/javascripts/application.js +15 -0
- data/spec/dummy_32/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy_32/app/controllers/application_controller.rb +3 -0
- data/spec/dummy_32/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_32/app/models/user.rb +3 -0
- data/spec/dummy_32/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_32/config/application.rb +65 -0
- data/spec/dummy_32/config/boot.rb +10 -0
- data/spec/dummy_32/config/database.yml +25 -0
- data/spec/dummy_32/config/environment.rb +5 -0
- data/spec/dummy_32/config/environments/development.rb +37 -0
- data/spec/dummy_32/config/environments/production.rb +67 -0
- data/spec/dummy_32/config/environments/test.rb +37 -0
- data/spec/dummy_32/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_32/config/initializers/inflections.rb +15 -0
- data/spec/dummy_32/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_32/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_32/config/initializers/session_store.rb +8 -0
- data/spec/dummy_32/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_32/config/locales/en.yml +5 -0
- data/spec/dummy_32/config/routes.rb +3 -0
- data/spec/dummy_32/config.ru +4 -0
- data/spec/dummy_32/db/development.sqlite3 +0 -0
- data/spec/dummy_32/db/migrate/20130607202020_create_users.rb +10 -0
- data/spec/dummy_32/db/schema.rb +23 -0
- data/spec/dummy_32/db/test.sqlite3 +0 -0
- data/spec/dummy_32/log/test.log +1520 -0
- data/spec/dummy_32/public/404.html +26 -0
- data/spec/dummy_32/public/422.html +26 -0
- data/spec/dummy_32/public/500.html +25 -0
- data/spec/dummy_32/public/favicon.ico +0 -0
- data/spec/dummy_32/script/rails +6 -0
- data/spec/dummy_32/spec/factories/users.rb +13 -0
- data/spec/dummy_40/README.rdoc +28 -0
- data/spec/dummy_40/Rakefile +6 -0
- data/spec/dummy_40/app/assets/javascripts/application.js +13 -0
- data/spec/dummy_40/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy_40/app/controllers/application_controller.rb +5 -0
- data/spec/dummy_40/app/helpers/application_helper.rb +2 -0
- data/spec/dummy_40/app/models/user.rb +2 -0
- data/spec/dummy_40/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy_40/bin/bundle +3 -0
- data/spec/dummy_40/bin/rails +4 -0
- data/spec/dummy_40/bin/rake +4 -0
- data/spec/dummy_40/config/application.rb +23 -0
- data/spec/dummy_40/config/boot.rb +5 -0
- data/spec/dummy_40/config/database.yml +25 -0
- data/spec/dummy_40/config/environment.rb +5 -0
- data/spec/dummy_40/config/environments/development.rb +29 -0
- data/spec/dummy_40/config/environments/production.rb +80 -0
- data/spec/dummy_40/config/environments/test.rb +36 -0
- data/spec/dummy_40/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_40/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy_40/config/initializers/inflections.rb +16 -0
- data/spec/dummy_40/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_40/config/initializers/secret_token.rb +12 -0
- data/spec/dummy_40/config/initializers/session_store.rb +3 -0
- data/spec/dummy_40/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_40/config/locales/en.yml +23 -0
- data/spec/dummy_40/config/routes.rb +4 -0
- data/spec/dummy_40/config.ru +4 -0
- data/spec/dummy_40/db/migrate/20130607202020_create_users.rb +10 -0
- data/spec/dummy_40/db/schema.rb +23 -0
- data/spec/dummy_40/db/test.sqlite3 +0 -0
- data/spec/dummy_40/log/test.log +175 -0
- data/spec/dummy_40/public/404.html +58 -0
- data/spec/dummy_40/public/422.html +58 -0
- data/spec/dummy_40/public/500.html +57 -0
- data/spec/dummy_40/public/favicon.ico +0 -0
- data/spec/dummy_40/spec/factories/users.rb +13 -0
- data/spec/factory_girl/remote_api/configuration_spec.rb +24 -0
- data/spec/factory_girl/remote_api/request_spec.rb +34 -0
- data/spec/factory_girl/remote_api_spec.rb +21 -0
- data/spec/features/client_factory_requests_spec.rb +59 -0
- data/spec/features/server_factory_requests_spec.rb +50 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/support/database_cleaner.rb +11 -0
- data/spec/support/require_dummy_factories.rb +2 -0
- data/spec/support/stub_with_real_response.rb +12 -0
- data.tar.gz.sig +0 -0
- metadata +485 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
2
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
|
3
|
+
[1m[36m (1.1ms)[0m [1mCREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar(255), "last_name" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
|
4
|
+
[1m[35m (0.9ms)[0m CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
|
|
5
|
+
[1m[36m (1.1ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
|
6
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
|
7
|
+
[1m[36m (1.0ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20130607202020')[0m
|
|
8
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
|
9
|
+
[1m[35m (0.1ms)[0m commit transaction
|
|
10
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
11
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
12
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
13
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
14
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
15
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
|
16
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
17
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
18
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
19
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
|
20
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
21
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
22
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
23
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
24
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
25
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
26
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
27
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
28
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
29
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
30
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
31
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
|
32
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
33
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
34
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
35
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
36
|
+
Started GET "/factories/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
37
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
38
|
+
Parameters: {"factory"=>"user"}
|
|
39
|
+
[1m[36mSQL (4.9ms)[0m [1mINSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "John"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
40
|
+
Completed 200 OK in 32ms (Views: 0.4ms | ActiveRecord: 4.9ms)
|
|
41
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
42
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1[0m
|
|
43
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
|
44
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
45
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
46
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
47
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
48
|
+
Started GET "/factories/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
49
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
50
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory"=>"user"}
|
|
51
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "James"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
52
|
+
Completed 200 OK in 3ms (Views: 0.3ms | ActiveRecord: 0.6ms)
|
|
53
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
54
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
|
55
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
56
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
57
|
+
[1m[35m (0.0ms)[0m begin transaction
|
|
58
|
+
Started GET "/factories/attributes_for/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
59
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
60
|
+
Parameters: {"factory_method"=>"attributes_for", "factory"=>"user"}
|
|
61
|
+
Completed 200 OK in 26ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
|
62
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
63
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
64
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
65
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
66
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
67
|
+
Started GET "/factories/build/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
68
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
69
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory_method"=>"build", "factory"=>"user"}
|
|
70
|
+
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
71
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
72
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
|
73
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
74
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
75
|
+
[1m[35m (0.0ms)[0m begin transaction
|
|
76
|
+
Started GET "/factories/build/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
77
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
78
|
+
Parameters: {"factory_method"=>"build", "factory"=>"user"}
|
|
79
|
+
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
80
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
81
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
82
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
83
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
84
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
85
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
86
|
+
Started GET "/factories/authenticated_user?authenticated_user[first_name]=James&authenticated_user[parent_factory]=user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
87
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
88
|
+
Parameters: {"authenticated_user"=>{"first_name"=>"James", "parent_factory"=>"user"}, "factory"=>"authenticated_user"}
|
|
89
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "James"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
90
|
+
Completed 200 OK in 3ms (Views: 0.3ms | ActiveRecord: 0.5ms)
|
|
91
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
92
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
|
93
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
94
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
95
|
+
[1m[35m (0.0ms)[0m begin transaction
|
|
96
|
+
Started GET "/factories/attributes_for/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
97
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
98
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory_method"=>"attributes_for", "factory"=>"user"}
|
|
99
|
+
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
100
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
101
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
102
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
103
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
104
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
105
|
+
Started GET "/factories/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
106
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
107
|
+
Parameters: {"factory"=>"user"}
|
|
108
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "John"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
109
|
+
Completed 200 OK in 3ms (Views: 0.3ms | ActiveRecord: 0.5ms)
|
|
110
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
111
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
|
112
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
113
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
114
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
115
|
+
Started GET "/factories/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
116
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
117
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory"=>"user"}
|
|
118
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "James"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
119
|
+
Completed 200 OK in 3ms (Views: 0.3ms | ActiveRecord: 0.5ms)
|
|
120
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
121
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
|
122
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
123
|
+
[1m[35m (0.1ms)[0m commit transaction
|
|
124
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
125
|
+
Started GET "/factories/attributes_for/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
126
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
127
|
+
Parameters: {"factory_method"=>"attributes_for", "factory"=>"user"}
|
|
128
|
+
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
129
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
130
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
|
131
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
132
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
133
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
134
|
+
Started GET "/factories/build/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
135
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
136
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory_method"=>"build", "factory"=>"user"}
|
|
137
|
+
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
138
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
139
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
140
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
141
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
142
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
143
|
+
Started GET "/factories/build/user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
144
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
145
|
+
Parameters: {"factory_method"=>"build", "factory"=>"user"}
|
|
146
|
+
Completed 200 OK in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
147
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
148
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
|
149
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
150
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
151
|
+
[1m[35m (0.0ms)[0m begin transaction
|
|
152
|
+
Started GET "/factories/authenticated_user?authenticated_user[first_name]=James&authenticated_user[parent_factory]=user" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
153
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#create as JSON
|
|
154
|
+
Parameters: {"authenticated_user"=>{"first_name"=>"James", "parent_factory"=>"user"}, "factory"=>"authenticated_user"}
|
|
155
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "users" ("created_at", "first_name", "last_name", "updated_at") VALUES (?, ?, ?, ?)[0m [["created_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00], ["first_name", "James"], ["last_name", "Doe"], ["updated_at", Tue, 18 Jun 2013 18:23:12 UTC +00:00]]
|
|
156
|
+
Completed 200 OK in 3ms (Views: 0.3ms | ActiveRecord: 0.5ms)
|
|
157
|
+
[1m[35m (0.1ms)[0m SELECT COUNT(*) FROM "users"
|
|
158
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
|
159
|
+
[1m[35m (0.1ms)[0m begin transaction
|
|
160
|
+
[1m[36m (0.0ms)[0m [1mcommit transaction[0m
|
|
161
|
+
[1m[35m (0.0ms)[0m begin transaction
|
|
162
|
+
Started GET "/factories/attributes_for/user?user[first_name]=James" for 127.0.0.1 at 2013-06-18 11:23:12 -0700
|
|
163
|
+
Processing by FactoryGirl::RemoteApi::FactoriesController#show as JSON
|
|
164
|
+
Parameters: {"user"=>{"first_name"=>"James"}, "factory_method"=>"attributes_for", "factory"=>"user"}
|
|
165
|
+
Completed 200 OK in 2ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
|
166
|
+
[1m[36m (0.1ms)[0m [1mSELECT COUNT(*) FROM "users"[0m
|
|
167
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
168
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
169
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
170
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
171
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
|
172
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
173
|
+
[1m[35m (0.0ms)[0m commit transaction
|
|
174
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
175
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
background-color: #EFEFEF;
|
|
8
|
+
color: #2E2F30;
|
|
9
|
+
text-align: center;
|
|
10
|
+
font-family: arial, sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
div.dialog {
|
|
14
|
+
width: 25em;
|
|
15
|
+
margin: 4em auto 0 auto;
|
|
16
|
+
border: 1px solid #CCC;
|
|
17
|
+
border-right-color: #999;
|
|
18
|
+
border-left-color: #999;
|
|
19
|
+
border-bottom-color: #BBB;
|
|
20
|
+
border-top: #B00100 solid 4px;
|
|
21
|
+
border-top-left-radius: 9px;
|
|
22
|
+
border-top-right-radius: 9px;
|
|
23
|
+
background-color: white;
|
|
24
|
+
padding: 7px 4em 0 4em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1 {
|
|
28
|
+
font-size: 100%;
|
|
29
|
+
color: #730E15;
|
|
30
|
+
line-height: 1.5em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body > p {
|
|
34
|
+
width: 33em;
|
|
35
|
+
margin: 0 auto 1em;
|
|
36
|
+
padding: 1em 0;
|
|
37
|
+
background-color: #F7F7F7;
|
|
38
|
+
border: 1px solid #CCC;
|
|
39
|
+
border-right-color: #999;
|
|
40
|
+
border-bottom-color: #999;
|
|
41
|
+
border-bottom-left-radius: 4px;
|
|
42
|
+
border-bottom-right-radius: 4px;
|
|
43
|
+
border-top-color: #DADADA;
|
|
44
|
+
color: #666;
|
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
</head>
|
|
49
|
+
|
|
50
|
+
<body>
|
|
51
|
+
<!-- This file lives in public/404.html -->
|
|
52
|
+
<div class="dialog">
|
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
55
|
+
</div>
|
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
background-color: #EFEFEF;
|
|
8
|
+
color: #2E2F30;
|
|
9
|
+
text-align: center;
|
|
10
|
+
font-family: arial, sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
div.dialog {
|
|
14
|
+
width: 25em;
|
|
15
|
+
margin: 4em auto 0 auto;
|
|
16
|
+
border: 1px solid #CCC;
|
|
17
|
+
border-right-color: #999;
|
|
18
|
+
border-left-color: #999;
|
|
19
|
+
border-bottom-color: #BBB;
|
|
20
|
+
border-top: #B00100 solid 4px;
|
|
21
|
+
border-top-left-radius: 9px;
|
|
22
|
+
border-top-right-radius: 9px;
|
|
23
|
+
background-color: white;
|
|
24
|
+
padding: 7px 4em 0 4em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1 {
|
|
28
|
+
font-size: 100%;
|
|
29
|
+
color: #730E15;
|
|
30
|
+
line-height: 1.5em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body > p {
|
|
34
|
+
width: 33em;
|
|
35
|
+
margin: 0 auto 1em;
|
|
36
|
+
padding: 1em 0;
|
|
37
|
+
background-color: #F7F7F7;
|
|
38
|
+
border: 1px solid #CCC;
|
|
39
|
+
border-right-color: #999;
|
|
40
|
+
border-bottom-color: #999;
|
|
41
|
+
border-bottom-left-radius: 4px;
|
|
42
|
+
border-bottom-right-radius: 4px;
|
|
43
|
+
border-top-color: #DADADA;
|
|
44
|
+
color: #666;
|
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
</head>
|
|
49
|
+
|
|
50
|
+
<body>
|
|
51
|
+
<!-- This file lives in public/422.html -->
|
|
52
|
+
<div class="dialog">
|
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
55
|
+
</div>
|
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<style>
|
|
6
|
+
body {
|
|
7
|
+
background-color: #EFEFEF;
|
|
8
|
+
color: #2E2F30;
|
|
9
|
+
text-align: center;
|
|
10
|
+
font-family: arial, sans-serif;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
div.dialog {
|
|
14
|
+
width: 25em;
|
|
15
|
+
margin: 4em auto 0 auto;
|
|
16
|
+
border: 1px solid #CCC;
|
|
17
|
+
border-right-color: #999;
|
|
18
|
+
border-left-color: #999;
|
|
19
|
+
border-bottom-color: #BBB;
|
|
20
|
+
border-top: #B00100 solid 4px;
|
|
21
|
+
border-top-left-radius: 9px;
|
|
22
|
+
border-top-right-radius: 9px;
|
|
23
|
+
background-color: white;
|
|
24
|
+
padding: 7px 4em 0 4em;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
h1 {
|
|
28
|
+
font-size: 100%;
|
|
29
|
+
color: #730E15;
|
|
30
|
+
line-height: 1.5em;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body > p {
|
|
34
|
+
width: 33em;
|
|
35
|
+
margin: 0 auto 1em;
|
|
36
|
+
padding: 1em 0;
|
|
37
|
+
background-color: #F7F7F7;
|
|
38
|
+
border: 1px solid #CCC;
|
|
39
|
+
border-right-color: #999;
|
|
40
|
+
border-bottom-color: #999;
|
|
41
|
+
border-bottom-left-radius: 4px;
|
|
42
|
+
border-bottom-right-radius: 4px;
|
|
43
|
+
border-top-color: #DADADA;
|
|
44
|
+
color: #666;
|
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
48
|
+
</head>
|
|
49
|
+
|
|
50
|
+
<body>
|
|
51
|
+
<!-- This file lives in public/500.html -->
|
|
52
|
+
<div class="dialog">
|
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
54
|
+
</div>
|
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Read about factories at https://github.com/thoughtbot/factory_girl
|
|
2
|
+
|
|
3
|
+
FactoryGirl.define do
|
|
4
|
+
factory :user do
|
|
5
|
+
first_name 'John'
|
|
6
|
+
last_name 'Doe'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
factory :authenticated_user, parent: :user do
|
|
10
|
+
first_name 'Jane'
|
|
11
|
+
last_name 'Doe'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FactoryGirl::RemoteApi::Configuration do
|
|
4
|
+
after(:each) { FactoryGirl::RemoteApi.reset_configuration }
|
|
5
|
+
|
|
6
|
+
describe '#server_url=' do
|
|
7
|
+
it 'removes trailing slashes' do
|
|
8
|
+
FactoryGirl::RemoteApi.configure { |config| config.server_url = 'http://localhost:1234/' }
|
|
9
|
+
expect(FactoryGirl::RemoteApi.configuration.server_url).to eq('http://localhost:1234')
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#server_mount_path=' do
|
|
14
|
+
it 'adds leading slash if absent' do
|
|
15
|
+
FactoryGirl::RemoteApi.configure { |config| config.server_mount_path = 'models' }
|
|
16
|
+
expect(FactoryGirl::RemoteApi.configuration.server_mount_path).to eq('/models')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'removes trailing slash if present' do
|
|
20
|
+
FactoryGirl::RemoteApi.configure { |config| config.server_mount_path = '/models/' }
|
|
21
|
+
expect(FactoryGirl::RemoteApi.configuration.server_mount_path).to eq('/models')
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FactoryGirl::RemoteApi::Request do
|
|
4
|
+
describe '#get_response_for' do
|
|
5
|
+
let(:config) { FactoryGirl::RemoteApi.configuration }
|
|
6
|
+
|
|
7
|
+
it 'returns the parsed json if no root is set' do
|
|
8
|
+
uri = URI("#{config.server_url}#{config.server_mount_path}/attributes_for/user?user%5Bfirst_name%5D=James")
|
|
9
|
+
Net::HTTP.should_receive(:get_response).with(uri).and_return(stub(:response, body: '{ "first_name": "James"}'))
|
|
10
|
+
response = FactoryGirl::RemoteApi::Request.new.get_response_for(:attributes_for, :user, first_name: "James")
|
|
11
|
+
expect(response).to eq("first_name" => "James")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'returns the model inside the root json element if present' do
|
|
15
|
+
uri = URI("#{config.server_url}#{config.server_mount_path}/attributes_for/user?user%5Bfirst_name%5D=James")
|
|
16
|
+
stub_response = stub(:response, body: '{ "user": {"first_name": "James"}}')
|
|
17
|
+
Net::HTTP.should_receive(:get_response).with(uri).and_return(stub_response)
|
|
18
|
+
response = FactoryGirl::RemoteApi::Request.new.get_response_for(:attributes_for, :user, first_name: "James")
|
|
19
|
+
expect(response).to eq("first_name" => "James")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'returns the model inside the root json element if the parent factory is set' do
|
|
23
|
+
url = "#{config.server_url}#{config.server_mount_path}/authenticated_user"
|
|
24
|
+
params = '?authenticated_user%5Bfirst_name%5D=James&authenticated_user%5Bparent_factory%5D=user'
|
|
25
|
+
uri = URI(url + params)
|
|
26
|
+
stub_response = stub(:response, body: '{ "user": {"first_name": "James"}}')
|
|
27
|
+
Net::HTTP.should_receive(:get_response).with(uri).and_return(stub_response)
|
|
28
|
+
response = FactoryGirl::RemoteApi::Request.new.get_response_for(:create,
|
|
29
|
+
:authenticated_user,
|
|
30
|
+
first_name: 'James', parent_factory: 'user')
|
|
31
|
+
expect(response).to eq("first_name" => "James")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe FactoryGirl::RemoteApi do
|
|
4
|
+
describe '.configuration' do
|
|
5
|
+
it 'accepts a server_url option' do
|
|
6
|
+
expect {
|
|
7
|
+
FactoryGirl::RemoteApi.configure { |config| config.server_url = 'http://localhost:3001' }
|
|
8
|
+
}.to change {
|
|
9
|
+
FactoryGirl::RemoteApi.configuration.server_url
|
|
10
|
+
}.from('http://localhost:3000').to('http://localhost:3001')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'accepts a server_mount_path option' do
|
|
14
|
+
expect {
|
|
15
|
+
FactoryGirl::RemoteApi.configure { |config| config.server_mount_path = '/models' }
|
|
16
|
+
}.to change {
|
|
17
|
+
FactoryGirl::RemoteApi.configuration.server_mount_path
|
|
18
|
+
}.from('/factories').to('/models')
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature 'Client factory requests' do
|
|
4
|
+
let(:config) { FactoryGirl::RemoteApi.configuration }
|
|
5
|
+
|
|
6
|
+
scenario 'create a user model from a remote factory' do
|
|
7
|
+
stub_with_real_response('/user?')
|
|
8
|
+
user = FactoryGirl::RemoteApi.create(:user)
|
|
9
|
+
expect(User.count).to eq(1)
|
|
10
|
+
expect(user.id).to_not be_nil
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
scenario 'create a user model from a remote factory with specific attributes' do
|
|
14
|
+
stub_with_real_response('/user?user%5Bfirst_name%5D=James')
|
|
15
|
+
user = FactoryGirl::RemoteApi.create(:user, first_name: 'James')
|
|
16
|
+
expect(User.count).to eq(1)
|
|
17
|
+
expect(user.id).to_not be_nil
|
|
18
|
+
expect(user.first_name).to eq('James')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
scenario 'create user model with specific attributes from a child factory' do
|
|
22
|
+
stub_with_real_response('/authenticated_user?authenticated_user%5Bfirst_name%5D=James&authenticated_user%5Bparent_factory%5D=user')
|
|
23
|
+
user = FactoryGirl::RemoteApi.create(:authenticated_user, first_name: 'James', parent_factory: 'user')
|
|
24
|
+
expect(User.count).to eq(1)
|
|
25
|
+
expect(user.id).to_not be_nil
|
|
26
|
+
expect(user.first_name).to eq('James')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
scenario 'build a user model from a remote factory' do
|
|
30
|
+
stub_with_real_response('/build/user?')
|
|
31
|
+
user = FactoryGirl::RemoteApi.build(:user)
|
|
32
|
+
expect(User.count).to eq(0)
|
|
33
|
+
expect(user.id).to be_nil
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
scenario 'build a user model from a remote factory with specific attributes' do
|
|
37
|
+
stub_with_real_response('/build/user?user%5Bfirst_name%5D=James')
|
|
38
|
+
user = FactoryGirl::RemoteApi.build(:user, first_name: 'James')
|
|
39
|
+
expect(User.count).to eq(0)
|
|
40
|
+
expect(user.id).to be_nil
|
|
41
|
+
expect(user.first_name).to eq('James')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
scenario 'attributes for a user model from a remote factory' do
|
|
45
|
+
stub_with_real_response('/attributes_for/user?')
|
|
46
|
+
user_attributes = FactoryGirl::RemoteApi.attributes_for(:user)
|
|
47
|
+
expect(User.count).to eq(0)
|
|
48
|
+
expect(user_attributes[:id]).to be_nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
scenario 'attributes for a user model from a remote factory with specific attributes' do
|
|
52
|
+
stub_with_real_response('/attributes_for/user?user%5Bfirst_name%5D=James')
|
|
53
|
+
user_attributes = FactoryGirl::RemoteApi.attributes_for(:user, first_name: 'James')
|
|
54
|
+
expect(User.count).to eq(0)
|
|
55
|
+
expect(user_attributes[:id]).to be_nil
|
|
56
|
+
expect(user_attributes['first_name']).to eq('James')
|
|
57
|
+
expect(user_attributes[:first_name]).to eq('James')
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
feature 'Server factory requests' do
|
|
4
|
+
scenario 'create a user model' do
|
|
5
|
+
expect {
|
|
6
|
+
visit '/factories/user'
|
|
7
|
+
}.to change { User.count }.from(0).to(1)
|
|
8
|
+
expect(page.body).to eq(User.first.to_json)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
scenario 'create a user model with specific attributes' do
|
|
12
|
+
expect {
|
|
13
|
+
visit '/factories/user?user[first_name]=James'
|
|
14
|
+
}.to change { User.count }.from(0).to(1)
|
|
15
|
+
expect(JSON.parse(page.body)['first_name']).to eq('James')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
scenario 'create user model with specific attributes from a child factory' do
|
|
19
|
+
expect {
|
|
20
|
+
visit '/factories/authenticated_user?authenticated_user[first_name]=James&authenticated_user[parent_factory]=user'
|
|
21
|
+
}.to change { User.count }.from(0).to(1)
|
|
22
|
+
expect(JSON.parse(page.body)['first_name']).to eq('James')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
scenario 'build a user model' do
|
|
26
|
+
visit '/factories/build/user'
|
|
27
|
+
expect(JSON.parse(page.body)['id']).to be_nil
|
|
28
|
+
expect(User.count).to eq(0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
scenario 'build a user model with specific attributes' do
|
|
32
|
+
visit '/factories/build/user?user[first_name]=James'
|
|
33
|
+
expect(JSON.parse(page.body)['id']).to be_nil
|
|
34
|
+
expect(JSON.parse(page.body)['first_name']).to eq('James')
|
|
35
|
+
expect(User.count).to eq(0)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
scenario 'get attributes for a user' do
|
|
39
|
+
visit '/factories/attributes_for/user'
|
|
40
|
+
expect(JSON.parse(page.body)['id']).to be_nil
|
|
41
|
+
expect(User.count).to eq(0)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
scenario 'get attributes for a user with specific attributes' do
|
|
45
|
+
visit '/factories/attributes_for/user?user[first_name]=James'
|
|
46
|
+
expect(JSON.parse(page.body)['id']).to be_nil
|
|
47
|
+
expect(JSON.parse(page.body)['first_name']).to eq('James')
|
|
48
|
+
expect(User.count).to eq(0)
|
|
49
|
+
end
|
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
require 'coveralls'
|
|
3
|
+
SimpleCov.formatter = Coveralls::SimpleCov::Formatter if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
|
4
|
+
SimpleCov.start
|
|
5
|
+
|
|
6
|
+
ENV['RAILS_ENV'] ||= 'test'
|
|
7
|
+
RAILS_MINOR_VERSION = if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
|
8
|
+
ENV['BUNDLE_GEMFILE'].split('/').last.scan(/(\d).(\d)/).join
|
|
9
|
+
else
|
|
10
|
+
'32'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
require File.expand_path("../dummy_#{RAILS_MINOR_VERSION}/config/environment", __FILE__)
|
|
14
|
+
require 'rspec/rails'
|
|
15
|
+
require 'rspec/autorun'
|
|
16
|
+
|
|
17
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
18
|
+
# in spec/support/ and its subdirectories.
|
|
19
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|f| require f }
|
|
20
|
+
|
|
21
|
+
RSpec.configure do |config|
|
|
22
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
23
|
+
# examples within a transaction, remove the following line or assign false
|
|
24
|
+
# instead of true.
|
|
25
|
+
config.use_transactional_fixtures = false # Database Cleaner
|
|
26
|
+
|
|
27
|
+
# If true, the base class of anonymous controllers will be inferred
|
|
28
|
+
# automatically. This will be the default behavior in future versions of
|
|
29
|
+
# rspec-rails.
|
|
30
|
+
config.infer_base_class_for_anonymous_controllers = false
|
|
31
|
+
|
|
32
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
33
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
34
|
+
# the seed, which is printed after each run.
|
|
35
|
+
# --seed 1234
|
|
36
|
+
config.order = 'random'
|
|
37
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module StubWithRealResponse
|
|
2
|
+
def stub_with_real_response(path)
|
|
3
|
+
FactoryGirl::RemoteApi.reset_configuration
|
|
4
|
+
visit [config.server_mount_path, path].join
|
|
5
|
+
uri = URI([config.server_url, config.server_mount_path, path].join)
|
|
6
|
+
Net::HTTP.should_receive(:get_response).with(uri).and_return(stub(:response, body: page.body))
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
config.include StubWithRealResponse
|
|
12
|
+
end
|
data.tar.gz.sig
ADDED
|
Binary file
|