1
나는이 user.abc_id.should == 0
을하려고하고 있으며오이를 사용하여 제로를 비교하는 방법?
expected: 0
got: "0" (using ==) (RSpec::Expectations::ExpectationNotMetError)
나는이 user.abc_id.should == 0
을하려고하고 있으며오이를 사용하여 제로를 비교하는 방법?
expected: 0
got: "0" (using ==) (RSpec::Expectations::ExpectationNotMetError)
문제는 데이브 주석에 말한대로입니다 수 대 문자열 말을 밖으로 오류가 발생했습니다. 당신이 볼 수 look at the rspec documentation 경우
a == b # object equivalence - a and b have the same value with type conversions
string object
및 integer object
은 동일하지 입니다.
그래서 당신은이
user.abc_id.should eql(0)
문제는 수 대 문자열 작동 할 수 귀하의 경우에는
뭔가를 시도 할 수 있습니다. 불행히도 당신은 질문에 대한 제로 컨텍스트를 제공합니다. –