如果可能的话,我想运行不加载 Rails 的 draper 装饰器规范,以坚持快速规范。我的大脑放屁让第二行开始工作。我错过了什么?
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