Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 88 lines (67 sloc) 2.977 kb
4dade1a @notahat Started taking notes for the README.
authored
1 # Machinist 2
2
634ec69 @notahat More documentation scribblings.
authored
3 *Fixtures aren't fun. Machinist is.*
4
df75114 @notahat README had a link to the old machinist2 branch.
authored
5 - [Home page](http://github.com/notahat/machinist)
b4de4de @notahat Moved more documentation to the wiki.
authored
6 - [What's new in Machinist 2](http://wiki.github.com/notahat/machinist/machinist-2)
7 - [Installation](http://wiki.github.com/notahat/machinist/installation)
d0f0941 @notahat Documentation.
authored
8 - [Documentation](http://wiki.github.com/notahat/machinist/getting-started)
d7dbd50 @notahat Added Rails 2 installation instructions.
authored
9 - [Google group](http://groups.google.com/group/machinist-users)
10 - [Issue tracker](http://github.com/notahat/machinist/issues)
634ec69 @notahat More documentation scribblings.
authored
11
966d19e @notahat Moved more stuff from the README to the wiki.
authored
12
ba72241 @notahat Working my way through documenting everything.
authored
13 # Introduction
634ec69 @notahat More documentation scribblings.
authored
14
d0f0941 @notahat Documentation.
authored
15 Machinist makes it easy to create objects within your tests. It generates data
16 for the attributes you don't care about, and constructs any necessary
17 associated objects, leaving you to specify only the attributes you *do* care
18 about in your tests. For example:
634ec69 @notahat More documentation scribblings.
authored
19
ba72241 @notahat Working my way through documenting everything.
authored
20 describe Comment do
21 it "should not include spam in the without_spam scope" do
d0f0941 @notahat Documentation.
authored
22 # This will make a Comment, a Post, and a User (the author of the
23 # Post), generate values for all their attributes, and save them:
ba72241 @notahat Working my way through documenting everything.
authored
24 spam = Comment.make!(:spam => true)
634ec69 @notahat More documentation scribblings.
authored
25
ba72241 @notahat Working my way through documenting everything.
authored
26 Comment.without_spam.should_not include(spam)
27 end
634ec69 @notahat More documentation scribblings.
authored
28 end
29
ba72241 @notahat Working my way through documenting everything.
authored
30 You tell Machinist how to do this with blueprints:
634ec69 @notahat More documentation scribblings.
authored
31
ba72241 @notahat Working my way through documenting everything.
authored
32 require 'machinist/active_record'
634ec69 @notahat More documentation scribblings.
authored
33
ba72241 @notahat Working my way through documenting everything.
authored
34 User.blueprint do
35 username { "user#{sn}" } # Each user gets a unique serial number.
36 end
37
38 Post.blueprint do
39 author
40 title { "Post #{sn}" }
41 body { "Lorem ipsum..." }
42 end
634ec69 @notahat More documentation scribblings.
authored
43
ba72241 @notahat Working my way through documenting everything.
authored
44 Comment.blueprint do
45 post
46 email { "commenter-#{sn}@example.com" }
47 body { "Lorem ipsum..." }
48 end
634ec69 @notahat More documentation scribblings.
authored
49
d0f0941 @notahat Documentation.
authored
50 Check out the
51 [documentation](http://wiki.github.com/notahat/machinist/getting-started) for
b4de4de @notahat Moved more documentation to the wiki.
authored
52 more info.
d7dbd50 @notahat Added Rails 2 installation instructions.
authored
53
54
ba72241 @notahat Working my way through documenting everything.
authored
55 ## Contributors
56
57 Machinist is maintained by Pete Yandell ([pete@notahat.com](mailto:pete@notahat.com), [@notahat](http://twitter.com/notahat))
58
59 Other contributors include:
60
61 [Marcos Arias](http://github.com/yizzreel),
62 [Jack Dempsey](http://github.com/jackdempsey),
df48e93 @notahat Added Jeremy Durham to contributors.
authored
63 [Jeremy Durham](http://github.com/jeremydurham),
ba72241 @notahat Working my way through documenting everything.
authored
64 [Clinton Forbes](http://github.com/clinton),
65 [Perryn Fowler](http://github.com/perryn),
66 [Niels Ganser](http://github.com/Nielsomat),
67 [Jeremy Grant](http://github.com/jeremygrant),
68 [Jon Guymon](http://github.com/gnarg),
69 [James Healy](http://github.com/yob),
417d24c @notahat Belatedly added Ben H and Xavier to contributors.
authored
70 [Ben Hoskings](http://github.com/benhoskings),
ba72241 @notahat Working my way through documenting everything.
authored
71 [Evan David Light](http://github.com/elight),
72 [Chris Lloyd](http://github.com/chrislloyd),
73 [Adam Meehan](http://github.com/adzap),
74 [Kyle Neath](http://github.com/kneath),
75 [Lawrence Pit](http://github.com/lawrencepit),
417d24c @notahat Belatedly added Ben H and Xavier to contributors.
authored
76 [Xavier Shay](http://github.com/xaviershay),
ba72241 @notahat Working my way through documenting everything.
authored
77 [T.J. Sheehy](http://github.com/tjsheehy),
78 [Roland Swingler](http://github.com/knaveofdiamonds),
79 [Gareth Townsend](http://github.com/quamen),
80 [Matt Wastrodowski](http://github.com/towski),
81 [Ian White](http://github.com/ianwhite)
82
83 Thanks to Thoughtbot's [Factory
84 Girl](http://github.com/thoughtbot/factory_girl/tree/master). Machinist was
85 written because I loved the idea behind Factory Girl, but I thought the
86 philosophy wasn't quite right, and I hated the syntax.
87
Something went wrong with that request. Please try again.