如何通过不加载Rails来运行快速Draper装饰器规范?

时间:2012-07-05 02:03:26

标签: ruby-on-rails ruby-on-rails-3 rspec draper

我想运行draper装饰器规格,如果可能的话,不加载Rails,以坚持快速规格。我有一个大脑放屁让第二线工作。我错过了什么?

require "rspec/mocks/standalone"
require "draper/test/rspec_integration"
require_relative "../../app/decorators/articles_decorator"

describe ArticleDecorator do
  describe "#published_date" do
    let(:article)           { double('Article', published_at: Time.now,
                                                content:      'content',
                                                abstract:     'abstract') }
    let(:decorated_article) { ArticleDecorator.new(article) }

    it "returns the article's published_at timestamp in long date form" do
      decorated_article.published_date.should == article.published_at.to_s(:long_date)
    end

    it "returns the article's content when an id is present" do
      decorated_article.abstract_or_content('id').should == 'content'
    end

    it "returns the article's abstract when an id is not present" do
      decorated_article.abstract_or_content.should == 'abstract'
    end
  end
end

0 个答案:

没有答案