Skip to content
Browse files

Documentation.

  • Loading branch information...
1 parent c605e3e commit d0f09410793d8ede581c91d09e5cca16b25f0e0b @notahat committed Jul 4, 2010
Showing with 15 additions and 21 deletions.
  1. +9 −8 README.markdown
  2. +5 −7 lib/machinist/blueprint.rb
  3. +1 −6 lib/machinist/warehouse.rb
View
17 README.markdown
@@ -5,22 +5,22 @@
- [Home page](http://github.com/notahat/machinist/tree/machinist2)
- [What's new in Machinist 2](http://wiki.github.com/notahat/machinist/machinist-2)
- [Installation](http://wiki.github.com/notahat/machinist/installation)
-- [Documentation](http://wiki.github.com/notahat/machinist/)
+- [Documentation](http://wiki.github.com/notahat/machinist/getting-started)
- [Google group](http://groups.google.com/group/machinist-users)
- [Issue tracker](http://github.com/notahat/machinist/issues)
# Introduction
-Machinist makes it easy to create test data within your tests. It generates
-data for the fields you don't care about, and constructs any necessary
-associated objects, leaving you to specify only the fields you *do* care about
-in your tests. For example:
+Machinist makes it easy to create objects within your tests. It generates data
+for the attributes you don't care about, and constructs any necessary
+associated objects, leaving you to specify only the attributes you *do* care
+about in your tests. For example:
describe Comment do
it "should not include spam in the without_spam scope" do
- # This will make a Comment, a Post, and a User (the author of
- # the Post), and generate values for all their attributes:
+ # This will make a Comment, a Post, and a User (the author of the
+ # Post), generate values for all their attributes, and save them:
spam = Comment.make!(:spam => true)
Comment.without_spam.should_not include(spam)
@@ -47,7 +47,8 @@ You tell Machinist how to do this with blueprints:
body { "Lorem ipsum..." }
end
-Check out the [documentation](http://wiki.github.com/notahat/machinist/) for
+Check out the
+[documentation](http://wiki.github.com/notahat/machinist/getting-started) for
more info.
View
12 lib/machinist/blueprint.rb
@@ -1,15 +1,12 @@
module Machinist
- # FIXME: Docs!
- #
- # You don't normally create or access Blueprints directly. See the blueprint
- # and make methods on Machinist::Machinable for examples of how it's usually
- # done.
+ # A Blueprint defines a method of constructing objects of a particular class.
class Blueprint
- # FIXME: More docs here.
+ # Construct a blueprint for the given +klass+.
#
- # The :parent option can be another Blueprint, or a class in which to look
+ # Pass in the +:parent+ option do define a parent blueprint to apply after
+ # this one. You can supply another blueprint, or a class in which to look
# for a blueprint. In the latter case, make will walk up the superclass
# chain looking for blueprints to apply.
def initialize(klass, options = {}, &block)
@@ -33,6 +30,7 @@ def make(attributes = {})
end
# Returns the Lathe class used to make objects for this blueprint.
+ #
# Subclasses can override this to substitute a custom lathe class.
def lathe_class
Lathe
View
7 lib/machinist/warehouse.rb
@@ -4,13 +4,8 @@ module Machinist
#
# It's used for storing cached objects created by Machinist::Shop.
#
- # For example, if you assign:
# warehouse[1, 2] = "Hello, world!"
- #
- # then:
- # warehouse[1, 2]
- #
- # will return "Hello, world!"
+ # warehouse[1, 2] # => "Hello, world!"
class Warehouse < Hash
# Assign a value for the given list of keys.

0 comments on commit d0f0941

Please sign in to comment.
Something went wrong with that request. Please try again.