theorem_spec.rb revision ad3d2e33936e011b85cbcaada213ff2fd732766f
715N/Arequire 'spec_helper'
715N/A
715N/Adescribe Theorem do
715N/A context 'Associations' do
715N/A it { should have_many(:proof_attempts) }
715N/A it { should belong_to(:proof_status) }
715N/A end
715N/A
715N/A context 'update_proof_status' do
715N/A let(:success) { create :proof_status_success }
715N/A let(:proven) { create :proof_status_proven }
715N/A let(:unknown) { create :proof_status_unknown }
715N/A
715N/A context 'from solved status' do
715N/A let(:theorem) { create :theorem, proof_status: success }
715N/A
715N/A context 'to solved status' do
715N/A before { theorem.update_proof_status(proven) }
715N/A
715N/A it 'theorem has updated status' do
715N/A expect(theorem.proof_status).to eq(proven)
715N/A end
715N/A end
715N/A
715N/A context 'to unsolved status' do
715N/A before { theorem.update_proof_status(unknown) }
715N/A
715N/A it 'theorem still has previous status' do
715N/A expect(theorem.proof_status).to eq(success)
715N/A end
715N/A end
715N/A end
715N/A
715N/A context 'from unsolved status' do
715N/A let(:theorem) { create :theorem, proof_status: unknown }
715N/A
715N/A context 'to solved status' do
715N/A before { theorem.update_proof_status(proven) }
726N/A
726N/A it 'theorem has updated status' do
726N/A expect(theorem.proof_status).to eq(proven)
715N/A end
715N/A end
715N/A
717N/A context 'to unsolved status' do
717N/A before { theorem.update_proof_status(unknown) }
715N/A
715N/A it 'theorem has updated status' do
718N/A expect(theorem.proof_status).to eq(unknown)
718N/A end
718N/A end
726N/A end
715N/A end
715N/Aend
715N/A