machinist 1.0.6 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +47 -0
- data/MIT-LICENSE +2 -1
- data/README.markdown +182 -204
- data/Rakefile +22 -29
- data/VERSION +1 -1
- data/lib/generators/machinist/install/USAGE +2 -0
- data/lib/generators/machinist/install/install_generator.rb +46 -0
- data/lib/generators/machinist/install/templates/blueprints.rb +9 -0
- data/lib/generators/machinist/install/templates/machinist.rb.erb +7 -0
- data/lib/generators/machinist/model/model_generator.rb +13 -0
- data/lib/machinist/active_record/blueprint.rb +16 -0
- data/lib/machinist/active_record/lathe.rb +24 -0
- data/lib/machinist/active_record.rb +8 -93
- data/lib/machinist/blueprint.rb +89 -0
- data/lib/machinist/exceptions.rb +32 -0
- data/lib/machinist/lathe.rb +68 -0
- data/lib/machinist/machinable.rb +95 -0
- data/lib/machinist/version.rb +3 -0
- data/lib/machinist.rb +4 -109
- data/machinist.gemspec +20 -65
- data/spec/active_record_spec.rb +85 -171
- data/spec/blueprint_spec.rb +76 -0
- data/spec/exceptions_spec.rb +20 -0
- data/spec/inheritance_spec.rb +104 -0
- data/spec/machinable_spec.rb +101 -0
- data/spec/spec_helper.rb +4 -6
- data/spec/support/active_record_environment.rb +65 -0
- metadata +125 -37
- data/.autotest +0 -7
- data/FAQ.markdown +0 -18
- data/init.rb +0 -2
- data/lib/machinist/blueprints.rb +0 -25
- data/lib/machinist/data_mapper.rb +0 -83
- data/lib/machinist/object.rb +0 -30
- data/lib/machinist/sequel.rb +0 -62
- data/lib/sham.rb +0 -77
- data/spec/data_mapper_spec.rb +0 -134
- data/spec/db/.gitignore +0 -1
- data/spec/db/schema.rb +0 -20
- data/spec/log/.gitignore +0 -1
- data/spec/machinist_spec.rb +0 -190
- data/spec/sequel_spec.rb +0 -146
- data/spec/sham_spec.rb +0 -95
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
machinist (2.0.0.beta2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (3.0.9)
|
10
|
+
activesupport (= 3.0.9)
|
11
|
+
builder (~> 2.1.2)
|
12
|
+
i18n (~> 0.5.0)
|
13
|
+
activerecord (3.0.9)
|
14
|
+
activemodel (= 3.0.9)
|
15
|
+
activesupport (= 3.0.9)
|
16
|
+
arel (~> 2.0.10)
|
17
|
+
tzinfo (~> 0.3.23)
|
18
|
+
activesupport (3.0.9)
|
19
|
+
arel (2.0.10)
|
20
|
+
builder (2.1.2)
|
21
|
+
diff-lcs (1.1.2)
|
22
|
+
i18n (0.5.0)
|
23
|
+
mysql (2.8.1)
|
24
|
+
rake (0.9.2)
|
25
|
+
rcov (0.9.9)
|
26
|
+
rdoc (3.6.1)
|
27
|
+
rspec (2.6.0)
|
28
|
+
rspec-core (~> 2.6.0)
|
29
|
+
rspec-expectations (~> 2.6.0)
|
30
|
+
rspec-mocks (~> 2.6.0)
|
31
|
+
rspec-core (2.6.4)
|
32
|
+
rspec-expectations (2.6.0)
|
33
|
+
diff-lcs (~> 1.1.2)
|
34
|
+
rspec-mocks (2.6.0)
|
35
|
+
tzinfo (0.3.28)
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
activerecord
|
42
|
+
machinist!
|
43
|
+
mysql
|
44
|
+
rake
|
45
|
+
rcov
|
46
|
+
rdoc
|
47
|
+
rspec
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2008 Peter Yandell
|
1
|
+
Copyright (c) 2008-2010 Peter Yandell
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -18,3 +18,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
data/README.markdown
CHANGED
@@ -1,295 +1,266 @@
|
|
1
|
-
Machinist
|
2
|
-
=========
|
1
|
+
# Machinist 2
|
3
2
|
|
4
3
|
*Fixtures aren't fun. Machinist is.*
|
5
|
-
|
6
|
-
Machinist
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
|
5
|
+
Machinist 2 is **still in beta**!
|
6
|
+
|
7
|
+
If you're using Rails 3, you'll want to give Machinist 2 a go, but be aware
|
8
|
+
that the documentation is still patchy.
|
9
|
+
|
10
|
+
That said, have a look at [the
|
11
|
+
specs](https://github.com/notahat/machinist/tree/master/spec), starting with
|
12
|
+
[the spec for
|
13
|
+
Machinable](https://github.com/notahat/machinist/blob/master/spec/machinable_spec.rb).
|
14
|
+
No, really, have a look. I wrote this code to be read, and the specs do a
|
15
|
+
pretty clean job of documenting what it all does.
|
16
|
+
|
17
|
+
If, on the other hand, you want the tried, tested, and well-documented official
|
18
|
+
release version of Machinist, [then go with Machinist
|
19
|
+
1](http://github.com/notahat/machinist/tree/1.0-maintenance).
|
20
|
+
|
21
|
+
- [Home page](http://github.com/notahat/machinist)
|
22
|
+
- [Google group](http://groups.google.com/group/machinist-users), for support
|
23
|
+
- [Bug tracker](http://github.com/notahat/machinist/issues), for reporting Machinist bugs
|
24
|
+
|
25
|
+
|
26
|
+
## Introduction
|
27
|
+
|
28
|
+
Machinist makes it easy to create objects for use in tests. It generates data
|
29
|
+
for the attributes you don't care about, and constructs any necessary
|
30
|
+
associated objects, leaving you to specify only the fields you care about in
|
31
|
+
your test. For example:
|
32
|
+
|
33
|
+
describe Comment, "without_spam scope" do
|
34
|
+
it "doesn't include spam" do
|
35
|
+
# This will make a Comment, a Post, and a User (the author of the
|
36
|
+
# Post), generate values for all their attributes, and save them:
|
37
|
+
spam = Comment.make!(:spam => true)
|
38
|
+
|
39
|
+
Comment.without_spam.should_not include(spam)
|
17
40
|
end
|
18
41
|
end
|
19
42
|
|
20
43
|
You tell Machinist how to do this with blueprints:
|
21
44
|
|
22
45
|
require 'machinist/active_record'
|
23
|
-
|
24
|
-
require 'faker'
|
25
|
-
|
26
|
-
Sham.name { Faker::Name.name }
|
27
|
-
Sham.email { Faker::Internet.email }
|
28
|
-
Sham.title { Faker::Lorem.sentence }
|
29
|
-
Sham.body { Faker::Lorem.paragraph }
|
30
|
-
|
46
|
+
|
31
47
|
User.blueprint do
|
32
|
-
|
33
|
-
email
|
48
|
+
username { "user#{sn}" } # Each user gets a unique serial number.
|
34
49
|
end
|
35
|
-
|
50
|
+
|
36
51
|
Post.blueprint do
|
37
|
-
title
|
38
52
|
author
|
39
|
-
|
53
|
+
title { "Post #{sn}" }
|
54
|
+
body { "Lorem ipsum..." }
|
40
55
|
end
|
41
|
-
|
56
|
+
|
42
57
|
Comment.blueprint do
|
43
58
|
post
|
44
|
-
|
45
|
-
|
46
|
-
body
|
59
|
+
email { "commenter#{sn}@example.com" }
|
60
|
+
body { "Lorem ipsum..." }
|
47
61
|
end
|
48
|
-
|
49
62
|
|
50
|
-
Download & Install
|
51
|
-
==================
|
52
63
|
|
53
|
-
|
64
|
+
## Installation
|
54
65
|
|
55
|
-
|
56
|
-
|
57
|
-
### Installing as a Gem
|
66
|
+
### Upgrading from Machinist 1
|
58
67
|
|
59
|
-
|
68
|
+
See [the wiki](http://wiki.github.com/notahat/machinist/machinist-2).
|
60
69
|
|
61
|
-
###
|
70
|
+
### Rails 3
|
62
71
|
|
63
|
-
|
72
|
+
In your app's `Gemfile`, in the `group :test` section, add:
|
64
73
|
|
65
|
-
|
66
|
-
require 'sham'
|
67
|
-
|
68
|
-
Substitute `data_mapper` or `sequel` for `active_record` if that's your weapon of choice.
|
69
|
-
|
70
|
-
Require `blueprints.rb` in your `test_helper.rb` (or `spec_helper.rb`):
|
74
|
+
gem 'machinist', '>= 2.0.0.beta2'
|
71
75
|
|
72
|
-
|
76
|
+
Then run:
|
73
77
|
|
74
|
-
|
75
|
-
|
76
|
-
setup { Sham.reset }
|
77
|
-
|
78
|
-
or, if you're on RSpec, in the `Spec::Runner.configure` block in your `spec_helper.rb`, add:
|
78
|
+
bundle
|
79
|
+
rails generate machinist:install
|
79
80
|
|
80
|
-
|
81
|
-
|
81
|
+
If you want Machinist to automatically add a blueprint to your blueprints file
|
82
|
+
whenever you generate a model, add the following to your `config/application.rb`
|
83
|
+
inside the Application class:
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
config.generators do |g|
|
86
|
+
g.fixture_replacement :machinist
|
87
|
+
end
|
86
88
|
|
87
|
-
|
88
|
-
----------------------------------
|
89
|
+
### Rails 2
|
89
90
|
|
90
|
-
|
91
|
+
See [the wiki](http://wiki.github.com/notahat/machinist/rails-2).
|
91
92
|
|
92
|
-
For example, you could define a way to generate random names as:
|
93
93
|
|
94
|
-
|
94
|
+
## Usage
|
95
95
|
|
96
|
-
|
96
|
+
### Blueprints
|
97
97
|
|
98
|
-
|
98
|
+
A blueprint describes how to generate an object. The blueprint takes care of
|
99
|
+
providing attributes that your test doesn't care about, leaving you to focus on
|
100
|
+
just the attributes that are important for the test.
|
101
|
+
|
102
|
+
A simple blueprint might look like this:
|
103
|
+
|
104
|
+
Post.blueprint do
|
105
|
+
title { "A Post" }
|
106
|
+
body { "Lorem ipsum..." }
|
107
|
+
end
|
108
|
+
|
109
|
+
You can then construct a Post from this blueprint with:
|
99
110
|
|
100
|
-
|
111
|
+
Post.make!
|
112
|
+
|
113
|
+
When you call `make!`, Machinist calls `Post.new`, then runs through the
|
114
|
+
attributes in your blueprint, calling the block for each attribute to generate
|
115
|
+
a value. It then saves and reloads the Post. (It throws an exception if the
|
116
|
+
Post can't be saved.)
|
101
117
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
Sham works very well with the excellent [Faker gem](http://faker.rubyforge.org/) by Benjamin Curtis. Using this, a much nicer way to generate names is:
|
106
|
-
|
107
|
-
Sham.name { Faker::Name.name }
|
108
|
-
|
109
|
-
Sham also supports generating numbered sequences if you prefer.
|
118
|
+
You can override values defined in the blueprint by passing a hash to make:
|
119
|
+
|
120
|
+
Post.make!(:title => "A Specific Title")
|
110
121
|
|
111
|
-
|
112
|
-
|
113
|
-
If you want to allow duplicate values for a sham, you can pass the `:unique` option:
|
122
|
+
If you want to generate an object without saving it to the database, replace
|
123
|
+
`make!` with `make`.
|
114
124
|
|
115
|
-
Sham.coin_toss(:unique => false) { rand(2) == 0 ? 'heads' : 'tails' }
|
116
|
-
|
117
|
-
You can create a bunch of sham definitions in one hit like this:
|
118
125
|
|
119
|
-
|
120
|
-
title { Faker::Lorem.words(5).join(' ') }
|
121
|
-
name { Faker::Name.name }
|
122
|
-
body { Faker::Lorem.paragraphs(3).join("\n\n") }
|
123
|
-
end
|
126
|
+
### Unique Attributes
|
124
127
|
|
128
|
+
For attributes that need to be unique, you can call the `sn` method from
|
129
|
+
within the attribute block to get a unique serial number for the object.
|
125
130
|
|
126
|
-
|
127
|
-
|
131
|
+
User.blueprint do
|
132
|
+
username { "user-#{sn}" }
|
133
|
+
end
|
134
|
+
|
128
135
|
|
129
|
-
|
136
|
+
### Associations
|
130
137
|
|
131
|
-
|
138
|
+
If your object needs associated objects, you can generate them like this:
|
132
139
|
|
133
|
-
|
134
|
-
|
135
|
-
author { Sham.name }
|
136
|
-
body { Sham.body }
|
140
|
+
Comment.blueprint do
|
141
|
+
post { Post.make }
|
137
142
|
end
|
143
|
+
|
144
|
+
Calling `Comment.make!` will construct a Comment and its associated Post, and
|
145
|
+
save both.
|
138
146
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
147
|
+
Machinist is smart enough to look at the association and work out what sort of
|
148
|
+
object it needs to create, so you can shorten the above blueprint to:
|
149
|
+
|
150
|
+
Comment.blueprint do
|
151
|
+
post
|
152
|
+
end
|
144
153
|
|
145
|
-
|
154
|
+
If you want to override the value for post when constructing the comment, you
|
155
|
+
can do this:
|
156
|
+
|
157
|
+
post = Post.make(:title => "A particular title)
|
158
|
+
comment = Comment.make(:post => post)
|
146
159
|
|
147
|
-
Post.make(:title => "A Specific Title")
|
148
|
-
|
149
|
-
If you don't supply a block for an attribute in the blueprint, Machinist will look for a Sham definition with the same name as the attribute, so you can shorten the above blueprint to:
|
150
160
|
|
151
|
-
|
152
|
-
|
153
|
-
author { Sham.name }
|
154
|
-
body
|
155
|
-
end
|
156
|
-
|
157
|
-
If you want to generate an object without saving it to the database, replace `make` with `make_unsaved`. (`make_unsaved` also ensures that any associated objects that need to be generated are not saved - although not if you are using Sequel. See the section on associations below.)
|
158
|
-
|
159
|
-
You can refer to already assigned attributes when constructing a new attribute:
|
161
|
+
For `has_many` and `has_and_belongs_to_many` associations, you can create
|
162
|
+
multiple associated objects like this:
|
160
163
|
|
161
164
|
Post.blueprint do
|
162
|
-
|
163
|
-
author { Sham.name }
|
164
|
-
body { "Post by #{author}" }
|
165
|
+
comments(3) # Makes 3 comments.
|
165
166
|
end
|
166
|
-
|
167
167
|
|
168
|
-
### Named Blueprints
|
169
168
|
|
170
|
-
Named
|
169
|
+
### Named Blueprints
|
171
170
|
|
171
|
+
Named blueprints let you define variations on an object. For example, suppose
|
172
|
+
some of your Users are administrators:
|
173
|
+
|
172
174
|
User.blueprint do
|
173
|
-
name
|
174
|
-
email
|
175
|
+
name { "User #{sn}" }
|
176
|
+
email { "user-#{sn}@example.com" }
|
175
177
|
end
|
176
|
-
|
178
|
+
|
177
179
|
User.blueprint(:admin) do
|
178
|
-
name {
|
180
|
+
name { "Admin User #{sn}" }
|
179
181
|
admin { true }
|
180
182
|
end
|
181
|
-
|
183
|
+
|
182
184
|
Calling:
|
183
|
-
|
184
|
-
User.make(:admin)
|
185
|
-
|
185
|
+
|
186
|
+
User.make!(:admin)
|
187
|
+
|
186
188
|
will use the `:admin` blueprint.
|
189
|
+
|
190
|
+
Named blueprints call the default blueprint to set any attributes not
|
191
|
+
specifically provided, so in this example the `email` attribute will still be
|
192
|
+
generated even for an admin user.
|
193
|
+
|
194
|
+
You must define a default blueprint for any class that has a named blueprint,
|
195
|
+
even if the default blueprint is empty.
|
187
196
|
|
188
|
-
Named blueprints call the default blueprint to set any attributes not specifically provided, so in this example the `email` attribute will still be generated even for an admin user.
|
189
197
|
|
198
|
+
### Blueprints on Plain Old Ruby Objects
|
190
199
|
|
191
|
-
|
200
|
+
Machinist also works with plain old Ruby objects. Let's say you have a class like:
|
201
|
+
|
202
|
+
class Post
|
203
|
+
extend Machinist::Machinable
|
192
204
|
|
193
|
-
|
194
|
-
|
195
|
-
Comment.blueprint do
|
196
|
-
post { Post.make }
|
205
|
+
attr_accessor :title
|
206
|
+
attr_accessor :body
|
197
207
|
end
|
198
|
-
|
199
|
-
Calling `Comment.make` will construct a Comment and its associated Post, and save both.
|
200
|
-
|
201
|
-
If you want to override the value for post when constructing the comment, you can do this:
|
202
208
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
Machinist is smart enough to look at the association and work out what sort of object it needs to create, so you can shorten the above blueprint to:
|
209
|
-
|
210
|
-
Comment.blueprint do
|
211
|
-
post
|
209
|
+
You can blueprint the Post class just like anything else:
|
210
|
+
|
211
|
+
Post.blueprint do
|
212
|
+
title { "A title!" }
|
213
|
+
body { "A body!" }
|
212
214
|
end
|
213
215
|
|
214
|
-
|
215
|
-
### Other Associations
|
216
|
+
And `Post.make` will construct a new Post.
|
216
217
|
|
217
|
-
For has\_many and has\_and\_belongs\_to\_many associations, ActiveRecord insists that the object be saved before any associated objects can be saved. That means you can't generate the associated objects from within the blueprint.
|
218
218
|
|
219
|
-
|
219
|
+
### Other Tricks
|
220
220
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
221
|
+
You can refer to already assigned attributes when constructing a new attribute:
|
222
|
+
|
223
|
+
Post.blueprint do
|
224
|
+
author { "Author #{sn}" }
|
225
|
+
body { "Post by #{object.author}" }
|
225
226
|
end
|
226
227
|
|
227
|
-
Note here that you can call `make` on a has\_many association. (This isn't yet supported for DataMapper.)
|
228
228
|
|
229
|
-
|
229
|
+
## Compatibility
|
230
230
|
|
231
|
-
|
232
|
-
Post.make(attributes) do |post|
|
233
|
-
3.times { post.comments.make }
|
234
|
-
end
|
235
|
-
end
|
231
|
+
I've tested this with:
|
236
232
|
|
233
|
+
Ruby versions: 1.8.7, 1.9.2
|
234
|
+
Rails versions: 2.3, 3.0
|
237
235
|
|
238
|
-
|
236
|
+
It may well be happy with other versions too, but I'm not promising anything.
|
237
|
+
Compatibility patches are welcome.
|
239
238
|
|
240
|
-
The `plan` method behaves like `make`, except it returns a hash of attributes, and doesn't save the object. This is useful for passing in to controller tests:
|
241
239
|
|
242
|
-
|
243
|
-
assert_difference('Post.count') do
|
244
|
-
post :create, :post => Post.plan
|
245
|
-
end
|
246
|
-
assert_redirected_to post_path(assigns(:post))
|
247
|
-
end
|
248
|
-
|
249
|
-
`plan` will save any associated objects. In this example, it will create an Author, and it knows that the controller expects an `author_id` attribute, rather than an `author` attribute, and makes this translation for you.
|
250
|
-
|
251
|
-
You can also call plan on has\_many associations, making it easy to test nested controllers:
|
252
|
-
|
253
|
-
test "should create comment" do
|
254
|
-
post = Post.make
|
255
|
-
assert_difference('Comment.count') do
|
256
|
-
post :create, :post_id => post.id, :comment => post.comments.plan
|
257
|
-
end
|
258
|
-
assert_redirected_to post_comment_path(post, assigns(:comment))
|
259
|
-
end
|
260
|
-
|
261
|
-
(Calling plan on associations is not yet supported in DataMapper.)
|
240
|
+
## Developing
|
262
241
|
|
242
|
+
The Machinist specs and source code were written to be read, and I'm pretty
|
243
|
+
happy with them. Don't be afraid to have a look under the hood!
|
263
244
|
|
264
|
-
|
245
|
+
If you want to submit a patch:
|
265
246
|
|
266
|
-
|
247
|
+
- Fork the project.
|
248
|
+
- Make your feature addition or bug fix.
|
249
|
+
- Add tests for it. This is important so I don't break it in a
|
250
|
+
future version unintentionally.
|
251
|
+
- Commit, do not mess with rakefile, version, or history.
|
252
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
253
|
+
- Send me a pull request. Bonus points for topic branches.
|
267
254
|
|
268
|
-
class Post
|
269
|
-
attr_accessor :title
|
270
|
-
attr_accessor :body
|
271
|
-
end
|
272
|
-
|
273
|
-
You can then do the following in your `blueprints.rb`:
|
274
255
|
|
275
|
-
|
276
|
-
|
277
|
-
Post.blueprint do
|
278
|
-
title "A title!"
|
279
|
-
body "A body!"
|
280
|
-
end
|
256
|
+
## Status
|
281
257
|
|
282
|
-
|
283
|
-
=========
|
258
|
+
In active use in a number of large Rails 2 apps.
|
284
259
|
|
285
|
-
|
260
|
+
Development has been sporadic, but is picking up again.
|
286
261
|
|
287
|
-
If you have questions, check out the [Google Group](http://groups.google.com/group/machinist-users).
|
288
262
|
|
289
|
-
|
290
|
-
|
291
|
-
Contributors
|
292
|
-
------------
|
263
|
+
## Contributors
|
293
264
|
|
294
265
|
Machinist is maintained by Pete Yandell ([pete@notahat.com](mailto:pete@notahat.com), [@notahat](http://twitter.com/notahat))
|
295
266
|
|
@@ -297,21 +268,28 @@ Other contributors include:
|
|
297
268
|
|
298
269
|
[Marcos Arias](http://github.com/yizzreel),
|
299
270
|
[Jack Dempsey](http://github.com/jackdempsey),
|
271
|
+
[Jeremy Durham](http://github.com/jeremydurham),
|
300
272
|
[Clinton Forbes](http://github.com/clinton),
|
301
273
|
[Perryn Fowler](http://github.com/perryn),
|
302
274
|
[Niels Ganser](http://github.com/Nielsomat),
|
303
275
|
[Jeremy Grant](http://github.com/jeremygrant),
|
304
276
|
[Jon Guymon](http://github.com/gnarg),
|
305
277
|
[James Healy](http://github.com/yob),
|
278
|
+
[Ben Hoskings](http://github.com/benhoskings),
|
306
279
|
[Evan David Light](http://github.com/elight),
|
307
280
|
[Chris Lloyd](http://github.com/chrislloyd),
|
308
281
|
[Adam Meehan](http://github.com/adzap),
|
309
282
|
[Kyle Neath](http://github.com/kneath),
|
310
283
|
[Lawrence Pit](http://github.com/lawrencepit),
|
284
|
+
[Xavier Shay](http://github.com/xaviershay),
|
311
285
|
[T.J. Sheehy](http://github.com/tjsheehy),
|
312
286
|
[Roland Swingler](http://github.com/knaveofdiamonds),
|
313
287
|
[Gareth Townsend](http://github.com/quamen),
|
314
288
|
[Matt Wastrodowski](http://github.com/towski),
|
315
289
|
[Ian White](http://github.com/ianwhite)
|
316
290
|
|
317
|
-
Thanks to Thoughtbot's [Factory
|
291
|
+
Thanks to Thoughtbot's [Factory
|
292
|
+
Girl](http://github.com/thoughtbot/factory_girl/tree/master). Machinist was
|
293
|
+
written because I loved the idea behind Factory Girl, but I thought the
|
294
|
+
philosophy wasn't quite right, and I hated the syntax.
|
295
|
+
|
data/Rakefile
CHANGED
@@ -1,37 +1,30 @@
|
|
1
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
gem.name = "machinist"
|
7
|
-
gem.summary = "Fixtures aren't fun. Machinist is."
|
8
|
-
gem.email = "pete@notahat.com"
|
9
|
-
gem.homepage = "http://github.com/notahat/machinist"
|
10
|
-
gem.authors = ["Pete Yandell"]
|
11
|
-
gem.has_rdoc = false
|
12
|
-
gem.add_development_dependency "rspec", ">= 1.2.8"
|
13
|
-
end
|
14
|
-
Jeweler::GemcutterTasks.new
|
15
|
-
rescue LoadError
|
16
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
17
|
-
end
|
5
|
+
require 'rake'
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'rdoc/task'
|
18
8
|
|
19
9
|
|
20
|
-
|
21
|
-
desc 'Run the specs.'
|
22
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
-
spec.libs << 'lib' << 'spec'
|
24
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
10
|
+
RSpec::Core::RakeTask.new
|
26
11
|
|
27
|
-
|
28
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
-
spec.libs << 'lib' << 'spec'
|
30
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
12
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
31
13
|
spec.rcov = true
|
14
|
+
spec.rcov_opts = ['--exclude', 'spec', '--exclude', '.rvm']
|
32
15
|
end
|
33
16
|
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
17
|
desc 'Run the specs.'
|
37
|
-
task :default => :
|
18
|
+
task :default => :rcov
|
19
|
+
|
20
|
+
|
21
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
22
|
+
rdoc.rdoc_dir = 'doc'
|
23
|
+
rdoc.title = 'Machinist'
|
24
|
+
rdoc.options << '--line-numbers'
|
25
|
+
rdoc.rdoc_files.include('lib')
|
26
|
+
end
|
27
|
+
|
28
|
+
task :notes do
|
29
|
+
system "grep -n -r 'FIXME\\|TODO' lib spec"
|
30
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0
|