我有一个非常基本的 RSpec 示例,它不起作用。这是代码:
require 'spec_helper'
describe "Referral-type functionality" do
describe "Affiliate system" do
before { @affiliate = Affiliate.create(account_id: 1) }
subject { @affiliate }
describe "URL should work" do
visit @affiliate.aff_url
end
end
end
但是,当我运行它时,rspec 给出了 NoMethodError,因为 @affiliate 为 nil。我错过了什么?