Permalink
Browse files

Update README.md

  • Loading branch information...
1 parent e7455b2 commit 6e825061bc2a482016b822358f80f43a51014105 @unders committed Apr 13, 2012
Showing with 39 additions and 28 deletions.
  1. +39 −28 README.md
View
@@ -24,60 +24,71 @@ Or install it yourself as:
1. Update Gemfile
- group :development, :test do
- gem 'letterpress', :require => 'letterpress/rails'
- end
+ ``` ruby
+ 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
+ ``` ruby
+ 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
+ ``` ruby
+ 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
+ ``` ruby
+ 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
+ ``` ruby
+ require "minitest_helper"
- it "must be valid" do
- @comment.valid?.must_equal true
- end
- end
+ 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

0 comments on commit 6e82506

Please sign in to comment.