proof_attempt_spec.rb revision f15a514d590a0ff1166c1d1792f6c048a2fc1e34
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenrequire 'spec_helper'
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainendescribe ProofAttempt do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen context 'Associations' do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen it { should belong_to(:theorem) }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen it { should belong_to(:proof_status) }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen end
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen context 'Updating Theorem Proof Status' do
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen let(:proof_attempt) { create :proof_attempt }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen let(:theorem) { proof_attempt.theorem }
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen before do
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen allow(theorem).to receive(:update_proof_status)
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen proof_attempt.proof_status = ProofStatus.find('SOL')
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen proof_attempt.save!
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen end
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen it 'calls update_status on the theorem' do
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen expect(theorem).to have_received(:update_proof_status)
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen end
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen end
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainenend
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen