Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
unders committed Apr 13, 2012
1 parent 6f3e14e commit e7455b2
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion README.md
Expand Up @@ -19,7 +19,65 @@ Or install it yourself as:

## Usage

TODO: Write usage instructions here
### Rails, ActiveRecord and minitest


1. Update Gemfile

group :development, :test do
gem 'letterpress', :require => 'letterpress/rails'
end

2. Install the gem

$ bundle install

3. Generate (test|spec)/blueprint.rb file

$ rails generate letterpress:install

4. Update config/application.rb

config.generators do |g|
g.test_framework :mini_test, :spec => true, :fixture_replacement => :letterpress
end

5. Generate a model object with its factory

$ rails generate model Comment post_id:integer body:text

6. It adds to the end of file (test|spec)/blueprint.rb

class Comment < Blueprint(ProxyMethods)
default do
post_id { 1 }
body { "MyText" }
end
end

7. Modify the generated blueprint according to your preferences

class Comment < Blueprint(ProxyMethods)
default do
post { Post.make.new }
body { "MyText" }
end
end

8. Write tests in test/comment_test.rb

require "minitest_helper"

class CommentTest < MiniTest::Rails::Model
before do
@comment = Comment.make.new
end

it "must be valid" do
@comment.valid?.must_equal true
end
end



Compatibility
Expand Down

0 comments on commit e7455b2

Please sign in to comment.