ruby - RSPEC delivers a Name error on my vote spec -
i'm getting name error votes don't quite understand. it's supposed make sure votes values of 1 , -1. i've been receiving lot of nonameerrors in code pretty recently, i'm wondering how should go fixing problems these. require 'rails_helper' describe vote def valid? (@vote == 1) || (@vote == -1) end describe "validations" before good_v = votes.new(value: 1) bad_v = votes.new(value: -1) no_v = votes.new(value: 2) end describe "value validation" "only allows -1 or 1 values" expect(good_v.valid?).to eq(true) expext(bad_v.valid?).to eq(true) expect(no_v.valid?).to eq(false) end end end end it doesn't seem votes method i'm using create vote. wanted use good_v = @post.votes.create(value: 1) , don't think that's working either...