1
이 확인 방법을 감안할 때 :이 확인 속성을 전환하지만, 심지어 컨트롤러하지만, 모든 것 같으면토글 스펙의 컨트롤러에서 작업하지만 : 레일 3 + RSpec에
if (@bucket.confirmation_code == @code)
puts "OLAAA"
@bucket.toggle!(:confirmation)
@bucket.save
flash[:success] = "Successfully confirmed bucket."
redirect_to bucket_url(@bucket)
else
flash[:fail] = "Error confirming bucket."
redirect_to bucket_url(@bucket)
end
나는 사양 테스트가를 (confirmation == true
), 테스트가 실패했습니다 (true
대신 confirmation == false
).
테스트는 다음과 같습니다
it "should have a confirmation URL" do
@attr3 = {:email => "[email protected]", :confirmation_code => "ola123"}
post :create, :bucket => @attr3
@bucket = Bucket.last
post :confirm, :id => @bucket.id, :code => "ola123"
@bucket.save
@bucket.confirmation.should == true
end