動作しない非常に基本的な 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
ただし、実行すると、@affiliate が nil であるため、rspec は NoMethodError を返します。私は何が欠けていますか?