From d947247197815a3c964eb285038f0c86f426a4ac Mon Sep 17 00:00:00 2001 From: Tyler Montgomery Date: Wed, 7 Dec 2011 16:06:34 -0700 Subject: [PATCH 1/3] Updated the Readme to include some notes on RSpec and Spork. --- Readme.markdown | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Readme.markdown b/Readme.markdown index 20685e1..e6d4bc1 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -318,6 +318,13 @@ class ArticleDecorator < ApplicationDecorator end end ``` +### Integration with RSpec + +Using the provided generator, Draper will place specs for your new decorator in `spec/decorators/`. +By default, specs in `spec/decorators` will be tagged as `type => :decorator`. Any spec tagged as `decorator` +will run `ApplicationController.new.set_current_view_context` which makes helpers available to the decorator. + +Note: If you're using Spork, you need to `require 'draper/rspec_integration'` in your Spork.prefork block. ## Issues / Pending From 358e93953c82c5206537aadbd62e5f4c5802c224 Mon Sep 17 00:00:00 2001 From: Tyler Montgomery Date: Wed, 7 Dec 2011 16:09:25 -0700 Subject: [PATCH 2/3] Moved RSpec notes under "Up and Running". --- Readme.markdown | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index e6d4bc1..8814f36 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -247,6 +247,13 @@ class ActicleMailer < ActionMailer::Base end end ``` +### Integration with RSpec + +Using the provided generator, Draper will place specs for your new decorator in `spec/decorators/`. +By default, specs in `spec/decorators` will be tagged as `type => :decorator`. Any spec tagged as `decorator` +will run `ApplicationController.new.set_current_view_context` which makes helpers available to the decorator. + +Note: If you're using Spork, you need to `require 'draper/rspec_integration'` in your Spork.prefork block. ## Possible Decoration Methods @@ -318,14 +325,6 @@ class ArticleDecorator < ApplicationDecorator end end ``` -### Integration with RSpec - -Using the provided generator, Draper will place specs for your new decorator in `spec/decorators/`. -By default, specs in `spec/decorators` will be tagged as `type => :decorator`. Any spec tagged as `decorator` -will run `ApplicationController.new.set_current_view_context` which makes helpers available to the decorator. - -Note: If you're using Spork, you need to `require 'draper/rspec_integration'` in your Spork.prefork block. - ## Issues / Pending * Documentation From 75ab9bb8c06558e70791d9eb891fe9d1b930eae1 Mon Sep 17 00:00:00 2001 From: Tyler Montgomery Date: Wed, 7 Dec 2011 16:19:27 -0700 Subject: [PATCH 3/3] Added notes about decorator specs that might live outside spec/decorators/ --- Readme.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index 8814f36..cb10399 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -250,8 +250,10 @@ end ### Integration with RSpec Using the provided generator, Draper will place specs for your new decorator in `spec/decorators/`. -By default, specs in `spec/decorators` will be tagged as `type => :decorator`. Any spec tagged as `decorator` -will run `ApplicationController.new.set_current_view_context` which makes helpers available to the decorator. + +By default, specs in `spec/decorators` will be tagged as `type => :decorator`. Any spec tagged as `decorator` will run `ApplicationController.new.set_current_view_context` which makes helpers available to the decorator. + +If your decorator specs live somewhere else, which they shouldn't, make sure to tag them with `type => :decorator`. If you don't tag them, Draper's helpers won't be available to your decorator while testing. Note: If you're using Spork, you need to `require 'draper/rspec_integration'` in your Spork.prefork block.