proof_attempt_spec.rb revision b4a0129f99341fb8b1f0d724e656d339c97e9db0
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amorerequire 'spec_helper'
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoredescribe ProofAttempt do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore context 'Validations' do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore context 'Status' do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore ProofAttempt::STATUSES.each do |status|
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore it "allow #{status.inspect}" do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore should allow_value(status).for(:status)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore [nil, '', ' ', 'green'].each do |status|
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore it "not allow #{status.inspect}" do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore should_not allow_value(status).for(:status)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore context 'decisive status' do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore %w(SOL SAT NOC SAB CSR).each do |status|
68c47f65208790c466e5e484f2293d3baed71c6aGarrett D'Amore it "#{status} is decisive" do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore expect(ProofAttempt.decisive_status?(status)).to be(true)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore %w(USD GUP Sln Non).each do |status|
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore it "#{status} is not decisive" do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore expect(ProofAttempt.decisive_status?(status)).to be(false)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore context 'Updating Theorem Proof Status' do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore let(:proof_attempt) { create :proof_attempt }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore let(:theorem) { proof_attempt.theorem }
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore before do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore allow(theorem).to receive(:update_proof_status)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore proof_attempt.status = 'SOL'
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore proof_attempt.save
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore it 'calls update_status on the theorem' do
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore expect(theorem).to have_received(:update_proof_status)
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore end
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amoreend
88447a05f537aabe9a1bc3d5313f22581ec992a7Garrett D'Amore