instance-factory 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +8 -5
- data/Gemfile.lock +95 -45
- data/VERSION +1 -1
- data/instance-factory.gemspec +33 -14
- data/lib/instance_factory.rb +2 -2
- data/spec/dummy/Gemfile +2 -2
- data/spec/dummy/Gemfile.lock +6 -3
- data/spec/dummy/app/models/adderess.rb +3 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/config/database.yml +8 -51
- data/spec/dummy/db/migrate/20140825230522_create_users.rb +10 -0
- data/spec/dummy/db/migrate/20140826004447_create_adderesses.rb +9 -0
- data/spec/dummy/db/schema.rb +31 -0
- data/spec/dummy/spec/change_user_between_tests_spec.rb +26 -0
- data/spec/dummy/spec/factories/suite.rb +18 -0
- data/spec/dummy/spec/mantain_user_on_before_spec.rb +12 -0
- data/spec/dummy/spec/should_not_create_another_spec.rb +43 -0
- data/spec/{spec_helper.rb → dummy/spec/spec_helper.rb} +2 -1
- data/spec/dummy/spec/support/instance_factory_configuration.rb +9 -0
- metadata +67 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5190080c4d583a326b020c1a35d5094c351301d4
|
4
|
+
data.tar.gz: bb6639728cc05f15e075f80d2ce1ab4d67d7df4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 690d05a18adbdab3a4e3118bf9e46a54eeab3e0d36107986416c1e72a42625161ec6c86f603b984702126203076e982d86a4098ea5e14a6645f05d02231156be
|
7
|
+
data.tar.gz: a47cd969237d47472babad066abc3235f23e7bda735f786bcf2b0530113b9b96e7a3e4ac4ad226b02c62d2dbf40f18a87a27ba786f6509784c6906dd1fc745a2
|
data/Gemfile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem "
|
5
|
-
gem "
|
6
|
-
gem "
|
7
|
-
gem "
|
8
|
-
gem "
|
4
|
+
gem "rails"
|
5
|
+
gem "sqlite3"
|
6
|
+
gem "shoulda"
|
7
|
+
gem "rdoc"
|
8
|
+
gem "bundler"
|
9
|
+
gem "jeweler"
|
10
|
+
gem "simplecov"
|
9
11
|
gem "rspec-rails"
|
12
|
+
gem 'factory_girl_rails'
|
10
13
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,60 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
actionmailer (4.1.5)
|
5
|
+
actionpack (= 4.1.5)
|
6
|
+
actionview (= 4.1.5)
|
7
|
+
mail (~> 2.5.4)
|
8
|
+
actionpack (4.1.5)
|
9
|
+
actionview (= 4.1.5)
|
10
|
+
activesupport (= 4.1.5)
|
7
11
|
rack (~> 1.5.2)
|
8
12
|
rack-test (~> 0.6.2)
|
9
|
-
actionview (4.1.
|
10
|
-
activesupport (= 4.1.
|
13
|
+
actionview (4.1.5)
|
14
|
+
activesupport (= 4.1.5)
|
11
15
|
builder (~> 3.1)
|
12
16
|
erubis (~> 2.7.0)
|
13
|
-
activemodel (4.1.
|
14
|
-
activesupport (= 4.1.
|
17
|
+
activemodel (4.1.5)
|
18
|
+
activesupport (= 4.1.5)
|
15
19
|
builder (~> 3.1)
|
16
|
-
|
20
|
+
activerecord (4.1.5)
|
21
|
+
activemodel (= 4.1.5)
|
22
|
+
activesupport (= 4.1.5)
|
23
|
+
arel (~> 5.0.0)
|
24
|
+
activesupport (4.1.5)
|
17
25
|
i18n (~> 0.6, >= 0.6.9)
|
18
26
|
json (~> 1.7, >= 1.7.7)
|
19
27
|
minitest (~> 5.1)
|
20
28
|
thread_safe (~> 0.1)
|
21
29
|
tzinfo (~> 1.1)
|
22
30
|
addressable (2.3.6)
|
31
|
+
arel (5.0.1.20140414130214)
|
23
32
|
builder (3.2.2)
|
24
33
|
descendants_tracker (0.0.4)
|
25
34
|
thread_safe (~> 0.3, >= 0.3.1)
|
26
35
|
diff-lcs (1.2.5)
|
27
|
-
docile (1.1.
|
36
|
+
docile (1.1.5)
|
28
37
|
erubis (2.7.0)
|
38
|
+
factory_girl (4.4.0)
|
39
|
+
activesupport (>= 3.0.0)
|
40
|
+
factory_girl_rails (4.4.1)
|
41
|
+
factory_girl (~> 4.4.0)
|
42
|
+
railties (>= 3.0.0)
|
29
43
|
faraday (0.9.0)
|
30
44
|
multipart-post (>= 1.2, < 3)
|
31
|
-
git (1.2.
|
32
|
-
github_api (0.
|
45
|
+
git (1.2.8)
|
46
|
+
github_api (0.12.1)
|
33
47
|
addressable (~> 2.3)
|
34
|
-
descendants_tracker (~> 0.0.
|
48
|
+
descendants_tracker (~> 0.0.4)
|
35
49
|
faraday (~> 0.8, < 0.10)
|
36
|
-
hashie (>=
|
50
|
+
hashie (>= 3.2)
|
37
51
|
multi_json (>= 1.7.5, < 2.0)
|
38
|
-
nokogiri (~> 1.6.
|
52
|
+
nokogiri (~> 1.6.3)
|
39
53
|
oauth2
|
40
|
-
hashie (2.
|
54
|
+
hashie (3.2.0)
|
41
55
|
highline (1.6.21)
|
42
|
-
|
56
|
+
hike (1.2.3)
|
57
|
+
i18n (0.6.11)
|
43
58
|
jeweler (2.0.1)
|
44
59
|
builder
|
45
60
|
bundler (>= 1.0)
|
@@ -50,67 +65,102 @@ GEM
|
|
50
65
|
rake
|
51
66
|
rdoc
|
52
67
|
json (1.8.1)
|
53
|
-
jwt (0.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
68
|
+
jwt (1.0.0)
|
69
|
+
mail (2.5.4)
|
70
|
+
mime-types (~> 1.16)
|
71
|
+
treetop (~> 1.4.8)
|
72
|
+
mime-types (1.25.1)
|
73
|
+
mini_portile (0.6.0)
|
74
|
+
minitest (5.4.0)
|
75
|
+
multi_json (1.10.1)
|
58
76
|
multi_xml (0.5.5)
|
59
77
|
multipart-post (2.0.0)
|
60
|
-
nokogiri (1.6.1)
|
61
|
-
mini_portile (
|
62
|
-
oauth2 (0.
|
78
|
+
nokogiri (1.6.3.1)
|
79
|
+
mini_portile (= 0.6.0)
|
80
|
+
oauth2 (1.0.0)
|
63
81
|
faraday (>= 0.8, < 0.10)
|
64
|
-
jwt (~>
|
82
|
+
jwt (~> 1.0)
|
65
83
|
multi_json (~> 1.3)
|
66
84
|
multi_xml (~> 0.5)
|
67
85
|
rack (~> 1.2)
|
86
|
+
polyglot (0.3.5)
|
68
87
|
rack (1.5.2)
|
69
88
|
rack-test (0.6.2)
|
70
89
|
rack (>= 1.0)
|
71
|
-
|
72
|
-
|
73
|
-
|
90
|
+
rails (4.1.5)
|
91
|
+
actionmailer (= 4.1.5)
|
92
|
+
actionpack (= 4.1.5)
|
93
|
+
actionview (= 4.1.5)
|
94
|
+
activemodel (= 4.1.5)
|
95
|
+
activerecord (= 4.1.5)
|
96
|
+
activesupport (= 4.1.5)
|
97
|
+
bundler (>= 1.3.0, < 2.0)
|
98
|
+
railties (= 4.1.5)
|
99
|
+
sprockets-rails (~> 2.0)
|
100
|
+
railties (4.1.5)
|
101
|
+
actionpack (= 4.1.5)
|
102
|
+
activesupport (= 4.1.5)
|
74
103
|
rake (>= 0.8.7)
|
75
104
|
thor (>= 0.18.1, < 2.0)
|
76
|
-
rake (10.3.
|
105
|
+
rake (10.3.2)
|
77
106
|
rdoc (3.12.2)
|
78
107
|
json (~> 1.4)
|
79
|
-
rspec-core (
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
108
|
+
rspec-core (3.0.4)
|
109
|
+
rspec-support (~> 3.0.0)
|
110
|
+
rspec-expectations (3.0.4)
|
111
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
+
rspec-support (~> 3.0.0)
|
113
|
+
rspec-mocks (3.0.4)
|
114
|
+
rspec-support (~> 3.0.0)
|
115
|
+
rspec-rails (3.0.2)
|
84
116
|
actionpack (>= 3.0)
|
85
|
-
activemodel (>= 3.0)
|
86
117
|
activesupport (>= 3.0)
|
87
118
|
railties (>= 3.0)
|
88
|
-
rspec-core (~>
|
89
|
-
rspec-expectations (~>
|
90
|
-
rspec-mocks (~>
|
119
|
+
rspec-core (~> 3.0.0)
|
120
|
+
rspec-expectations (~> 3.0.0)
|
121
|
+
rspec-mocks (~> 3.0.0)
|
122
|
+
rspec-support (~> 3.0.0)
|
123
|
+
rspec-support (3.0.4)
|
91
124
|
shoulda (3.5.0)
|
92
125
|
shoulda-context (~> 1.0, >= 1.0.1)
|
93
126
|
shoulda-matchers (>= 1.4.1, < 3.0)
|
94
127
|
shoulda-context (1.2.1)
|
95
|
-
shoulda-matchers (2.6.
|
128
|
+
shoulda-matchers (2.6.2)
|
96
129
|
activesupport (>= 3.0.0)
|
97
|
-
simplecov (0.
|
130
|
+
simplecov (0.9.0)
|
98
131
|
docile (~> 1.1.0)
|
99
132
|
multi_json
|
100
133
|
simplecov-html (~> 0.8.0)
|
101
134
|
simplecov-html (0.8.0)
|
135
|
+
sprockets (2.12.1)
|
136
|
+
hike (~> 1.2)
|
137
|
+
multi_json (~> 1.0)
|
138
|
+
rack (~> 1.0)
|
139
|
+
tilt (~> 1.1, != 1.3.0)
|
140
|
+
sprockets-rails (2.1.3)
|
141
|
+
actionpack (>= 3.0)
|
142
|
+
activesupport (>= 3.0)
|
143
|
+
sprockets (~> 2.8)
|
144
|
+
sqlite3 (1.3.9)
|
102
145
|
thor (0.19.1)
|
103
|
-
thread_safe (0.3.
|
104
|
-
|
146
|
+
thread_safe (0.3.4)
|
147
|
+
tilt (1.4.1)
|
148
|
+
treetop (1.4.15)
|
149
|
+
polyglot
|
150
|
+
polyglot (>= 0.3.1)
|
151
|
+
tzinfo (1.2.2)
|
105
152
|
thread_safe (~> 0.1)
|
106
153
|
|
107
154
|
PLATFORMS
|
108
155
|
ruby
|
109
156
|
|
110
157
|
DEPENDENCIES
|
111
|
-
bundler
|
112
|
-
|
113
|
-
|
158
|
+
bundler
|
159
|
+
factory_girl_rails
|
160
|
+
jeweler
|
161
|
+
rails
|
162
|
+
rdoc
|
114
163
|
rspec-rails
|
115
164
|
shoulda
|
116
165
|
simplecov
|
166
|
+
sqlite3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/instance-factory.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: instance-factory 0.0.
|
5
|
+
# stub: instance-factory 0.0.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "instance-factory"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Victor Antoniazzi"]
|
14
|
-
s.date = "2014-08-
|
14
|
+
s.date = "2014-08-26"
|
15
15
|
s.description = "Manage your FactoryGirl for create a unique instance of model associations and integrate with rspec"
|
16
16
|
s.email = "vgsantoniazzi@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -45,7 +45,9 @@ Gem::Specification.new do |s|
|
|
45
45
|
"spec/dummy/app/helpers/application_helper.rb",
|
46
46
|
"spec/dummy/app/mailers/.keep",
|
47
47
|
"spec/dummy/app/models/.keep",
|
48
|
+
"spec/dummy/app/models/adderess.rb",
|
48
49
|
"spec/dummy/app/models/concerns/.keep",
|
50
|
+
"spec/dummy/app/models/user.rb",
|
49
51
|
"spec/dummy/app/views/layouts/application.html.erb",
|
50
52
|
"spec/dummy/bin/bundle",
|
51
53
|
"spec/dummy/bin/rails",
|
@@ -69,6 +71,9 @@ Gem::Specification.new do |s|
|
|
69
71
|
"spec/dummy/config/locales/en.yml",
|
70
72
|
"spec/dummy/config/routes.rb",
|
71
73
|
"spec/dummy/config/secrets.yml",
|
74
|
+
"spec/dummy/db/migrate/20140825230522_create_users.rb",
|
75
|
+
"spec/dummy/db/migrate/20140826004447_create_adderesses.rb",
|
76
|
+
"spec/dummy/db/schema.rb",
|
72
77
|
"spec/dummy/db/seeds.rb",
|
73
78
|
"spec/dummy/lib/assets/.keep",
|
74
79
|
"spec/dummy/lib/tasks/.keep",
|
@@ -78,9 +83,14 @@ Gem::Specification.new do |s|
|
|
78
83
|
"spec/dummy/public/500.html",
|
79
84
|
"spec/dummy/public/favicon.ico",
|
80
85
|
"spec/dummy/public/robots.txt",
|
86
|
+
"spec/dummy/spec/change_user_between_tests_spec.rb",
|
87
|
+
"spec/dummy/spec/factories/suite.rb",
|
88
|
+
"spec/dummy/spec/mantain_user_on_before_spec.rb",
|
89
|
+
"spec/dummy/spec/should_not_create_another_spec.rb",
|
90
|
+
"spec/dummy/spec/spec_helper.rb",
|
91
|
+
"spec/dummy/spec/support/instance_factory_configuration.rb",
|
81
92
|
"spec/dummy/vendor/assets/javascripts/.keep",
|
82
|
-
"spec/dummy/vendor/assets/stylesheets/.keep"
|
83
|
-
"spec/spec_helper.rb"
|
93
|
+
"spec/dummy/vendor/assets/stylesheets/.keep"
|
84
94
|
]
|
85
95
|
s.homepage = "http://github.com/vgsantoniazzi/instance-factory"
|
86
96
|
s.licenses = ["MIT"]
|
@@ -91,27 +101,36 @@ Gem::Specification.new do |s|
|
|
91
101
|
s.specification_version = 4
|
92
102
|
|
93
103
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
104
|
+
s.add_development_dependency(%q<rails>, [">= 0"])
|
105
|
+
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
94
106
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
95
|
-
s.add_development_dependency(%q<rdoc>, ["
|
96
|
-
s.add_development_dependency(%q<bundler>, ["
|
97
|
-
s.add_development_dependency(%q<jeweler>, ["
|
107
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
108
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
109
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
98
110
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
99
111
|
s.add_development_dependency(%q<rspec-rails>, [">= 0"])
|
112
|
+
s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
|
100
113
|
else
|
114
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
115
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
101
116
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
102
|
-
s.add_dependency(%q<rdoc>, ["
|
103
|
-
s.add_dependency(%q<bundler>, ["
|
104
|
-
s.add_dependency(%q<jeweler>, ["
|
117
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
118
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
119
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
105
120
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
106
121
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
122
|
+
s.add_dependency(%q<factory_girl_rails>, [">= 0"])
|
107
123
|
end
|
108
124
|
else
|
125
|
+
s.add_dependency(%q<rails>, [">= 0"])
|
126
|
+
s.add_dependency(%q<sqlite3>, [">= 0"])
|
109
127
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
110
|
-
s.add_dependency(%q<rdoc>, ["
|
111
|
-
s.add_dependency(%q<bundler>, ["
|
112
|
-
s.add_dependency(%q<jeweler>, ["
|
128
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
129
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
130
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
113
131
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
114
132
|
s.add_dependency(%q<rspec-rails>, [">= 0"])
|
133
|
+
s.add_dependency(%q<factory_girl_rails>, [">= 0"])
|
115
134
|
end
|
116
135
|
end
|
117
136
|
|
data/lib/instance_factory.rb
CHANGED
@@ -6,7 +6,7 @@ module InstanceFactory
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def instance_factory_clear!
|
9
|
-
InstanceFactoryVariables.clear
|
9
|
+
InstanceFactoryVariables.clear!
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
# Intern class for manage class variables
|
33
33
|
#
|
34
34
|
class InstanceFactoryVariables
|
35
|
-
def self.clear
|
35
|
+
def self.clear!
|
36
36
|
class_variables.each{|var| remove_class_variable(var) }
|
37
37
|
end
|
38
38
|
end
|
data/spec/dummy/Gemfile
CHANGED
data/spec/dummy/Gemfile.lock
CHANGED
@@ -33,6 +33,9 @@ GEM
|
|
33
33
|
erubis (2.7.0)
|
34
34
|
factory_girl (4.4.0)
|
35
35
|
activesupport (>= 3.0.0)
|
36
|
+
factory_girl_rails (4.4.1)
|
37
|
+
factory_girl (~> 4.4.0)
|
38
|
+
railties (>= 3.0.0)
|
36
39
|
hike (1.2.3)
|
37
40
|
i18n (0.6.9)
|
38
41
|
json (1.8.1)
|
@@ -42,7 +45,6 @@ GEM
|
|
42
45
|
mime-types (1.25.1)
|
43
46
|
minitest (5.3.3)
|
44
47
|
multi_json (1.10.0)
|
45
|
-
mysql2 (0.3.15)
|
46
48
|
polyglot (0.3.4)
|
47
49
|
rack (1.5.2)
|
48
50
|
rack-test (0.6.2)
|
@@ -84,6 +86,7 @@ GEM
|
|
84
86
|
actionpack (>= 3.0)
|
85
87
|
activesupport (>= 3.0)
|
86
88
|
sprockets (~> 2.8)
|
89
|
+
sqlite3 (1.3.9)
|
87
90
|
thor (0.19.1)
|
88
91
|
thread_safe (0.3.3)
|
89
92
|
tilt (1.4.1)
|
@@ -97,7 +100,7 @@ PLATFORMS
|
|
97
100
|
ruby
|
98
101
|
|
99
102
|
DEPENDENCIES
|
100
|
-
|
101
|
-
mysql2
|
103
|
+
factory_girl_rails
|
102
104
|
rails (= 4.1.1)
|
103
105
|
rspec-rails
|
106
|
+
sqlite3
|
@@ -1,54 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# gem install mysql2
|
5
|
-
#
|
6
|
-
# Ensure the MySQL gem is defined in your Gemfile
|
7
|
-
# gem 'mysql2'
|
8
|
-
#
|
9
|
-
# And be sure to use new-style password hashing:
|
10
|
-
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
|
11
|
-
#
|
12
|
-
default: &default
|
13
|
-
adapter: mysql2
|
14
|
-
encoding: utf8
|
1
|
+
test:
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/test.sqlite3
|
15
4
|
pool: 5
|
16
|
-
|
17
|
-
password:
|
18
|
-
socket: /tmp/mysql.sock
|
5
|
+
timeout: 5000
|
19
6
|
|
20
7
|
development:
|
21
|
-
|
22
|
-
database:
|
23
|
-
|
24
|
-
|
25
|
-
# re-generated from your development database when you run "rake".
|
26
|
-
# Do not set this db to the same as development or production.
|
27
|
-
test:
|
28
|
-
<<: *default
|
29
|
-
database: dummy_test
|
30
|
-
|
31
|
-
# As with config/secrets.yml, you never want to store sensitive information,
|
32
|
-
# like your database password, in your source code. If your source code is
|
33
|
-
# ever seen by anyone, they now have access to your database.
|
34
|
-
#
|
35
|
-
# Instead, provide the password as a unix environment variable when you boot
|
36
|
-
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
37
|
-
# for a full rundown on how to provide these environment variables in a
|
38
|
-
# production deployment.
|
39
|
-
#
|
40
|
-
# On Heroku and other platform providers, you may have a full connection URL
|
41
|
-
# available as an environment variable. For example:
|
42
|
-
#
|
43
|
-
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
44
|
-
#
|
45
|
-
# You can use this database configuration with:
|
46
|
-
#
|
47
|
-
# production:
|
48
|
-
# url: <%= ENV['DATABASE_URL'] %>
|
49
|
-
#
|
50
|
-
production:
|
51
|
-
<<: *default
|
52
|
-
database: dummy_production
|
53
|
-
username: dummy
|
54
|
-
password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
8
|
+
adapter: sqlite3
|
9
|
+
database: db/dev.sqlite3
|
10
|
+
pool: 5
|
11
|
+
timeout: 5000
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20140826004447) do
|
15
|
+
|
16
|
+
create_table "adderesses", force: true do |t|
|
17
|
+
t.integer "user_id"
|
18
|
+
t.string "name"
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "users", force: true do |t|
|
24
|
+
t.string "name"
|
25
|
+
t.integer "age"
|
26
|
+
t.boolean "admin", default: false
|
27
|
+
t.datetime "created_at"
|
28
|
+
t.datetime "updated_at"
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'mantain database clear' do
|
4
|
+
|
5
|
+
context 'can view @user' do
|
6
|
+
before do
|
7
|
+
@user = instance_factory(:user)
|
8
|
+
end
|
9
|
+
|
10
|
+
it '#count' do
|
11
|
+
expect(User.count).to eq(1)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'user should be avaliable here' do
|
15
|
+
expect(@user).to eq instance_factory(:user)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'cannot view @user' do
|
20
|
+
|
21
|
+
it '#count' do
|
22
|
+
expect(User.count).to eq(0)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :user do
|
3
|
+
sequence :id do |n|
|
4
|
+
n
|
5
|
+
end
|
6
|
+
name "Victor Antoniazzi"
|
7
|
+
age 20
|
8
|
+
admin false
|
9
|
+
end
|
10
|
+
|
11
|
+
factory :adderess do
|
12
|
+
sequence :id do |n|
|
13
|
+
n
|
14
|
+
end
|
15
|
+
name "Rua uruguai 1403"
|
16
|
+
user { instance_factory(:user) }
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'mantain database clear' do
|
4
|
+
|
5
|
+
context 'can view @user' do
|
6
|
+
before do
|
7
|
+
@user = instance_factory(:user)
|
8
|
+
@adderess = instance_factory(:adderess)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'same adderess' do
|
12
|
+
expect(@user.adderesses.first).to eq(instance_factory(:adderess))
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'same user' do
|
16
|
+
expect(@adderess.user).to eq instance_factory(:user)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'should create user' do
|
21
|
+
|
22
|
+
before do
|
23
|
+
@adderess = instance_factory(:adderess)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'user' do
|
27
|
+
expect(@adderess.user).to eq instance_factory(:user)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'should create user' do
|
33
|
+
|
34
|
+
before do
|
35
|
+
@adderess = FactoryGirl.create(:adderess)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'user' do
|
39
|
+
expect(@adderess.user).to eq instance_factory(:user)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
2
|
ENV["RAILS_ENV"] ||= 'test'
|
3
|
-
require File.expand_path("
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
4
|
require 'rspec/rails'
|
5
5
|
require 'rspec/autorun'
|
6
|
+
require_relative '../../../lib/instance_factory'
|
6
7
|
|
7
8
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
8
9
|
# in spec/support/ and its subdirectories.
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instance-factory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Antoniazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
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'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: shoulda
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -28,44 +56,44 @@ dependencies:
|
|
28
56
|
name: rdoc
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
30
58
|
requirements:
|
31
|
-
- - "
|
59
|
+
- - ">="
|
32
60
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
61
|
+
version: '0'
|
34
62
|
type: :development
|
35
63
|
prerelease: false
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
37
65
|
requirements:
|
38
|
-
- - "
|
66
|
+
- - ">="
|
39
67
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
68
|
+
version: '0'
|
41
69
|
- !ruby/object:Gem::Dependency
|
42
70
|
name: bundler
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
|
-
- - "
|
73
|
+
- - ">="
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '0'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
|
-
- - "
|
80
|
+
- - ">="
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: jeweler
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- - "
|
87
|
+
- - ">="
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
89
|
+
version: '0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- - "
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: simplecov
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +122,20 @@ dependencies:
|
|
94
122
|
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: factory_girl_rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
97
139
|
description: Manage your FactoryGirl for create a unique instance of model associations
|
98
140
|
and integrate with rspec
|
99
141
|
email: vgsantoniazzi@gmail.com
|
@@ -129,7 +171,9 @@ files:
|
|
129
171
|
- spec/dummy/app/helpers/application_helper.rb
|
130
172
|
- spec/dummy/app/mailers/.keep
|
131
173
|
- spec/dummy/app/models/.keep
|
174
|
+
- spec/dummy/app/models/adderess.rb
|
132
175
|
- spec/dummy/app/models/concerns/.keep
|
176
|
+
- spec/dummy/app/models/user.rb
|
133
177
|
- spec/dummy/app/views/layouts/application.html.erb
|
134
178
|
- spec/dummy/bin/bundle
|
135
179
|
- spec/dummy/bin/rails
|
@@ -153,6 +197,9 @@ files:
|
|
153
197
|
- spec/dummy/config/locales/en.yml
|
154
198
|
- spec/dummy/config/routes.rb
|
155
199
|
- spec/dummy/config/secrets.yml
|
200
|
+
- spec/dummy/db/migrate/20140825230522_create_users.rb
|
201
|
+
- spec/dummy/db/migrate/20140826004447_create_adderesses.rb
|
202
|
+
- spec/dummy/db/schema.rb
|
156
203
|
- spec/dummy/db/seeds.rb
|
157
204
|
- spec/dummy/lib/assets/.keep
|
158
205
|
- spec/dummy/lib/tasks/.keep
|
@@ -162,9 +209,14 @@ files:
|
|
162
209
|
- spec/dummy/public/500.html
|
163
210
|
- spec/dummy/public/favicon.ico
|
164
211
|
- spec/dummy/public/robots.txt
|
212
|
+
- spec/dummy/spec/change_user_between_tests_spec.rb
|
213
|
+
- spec/dummy/spec/factories/suite.rb
|
214
|
+
- spec/dummy/spec/mantain_user_on_before_spec.rb
|
215
|
+
- spec/dummy/spec/should_not_create_another_spec.rb
|
216
|
+
- spec/dummy/spec/spec_helper.rb
|
217
|
+
- spec/dummy/spec/support/instance_factory_configuration.rb
|
165
218
|
- spec/dummy/vendor/assets/javascripts/.keep
|
166
219
|
- spec/dummy/vendor/assets/stylesheets/.keep
|
167
|
-
- spec/spec_helper.rb
|
168
220
|
homepage: http://github.com/vgsantoniazzi/instance-factory
|
169
221
|
licenses:
|
170
222
|
- MIT
|