Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + '/../test_helper'
- class AttemptTest < ActiveSupport::TestCase
- fixtures :attempts, :exam_sections
- context "An Attempt instance" do
- context "that's expired but not completed" do
- setup do
- @attempt = attempts(:expired)
- end
- should "return false when sent #expired?" do
- assert @attempt.expired?
- end
- should "return true when sent #started?" do
- assert @attempt.started?
- end
- should "not be accessible" do
- assert !@attempt.accessible?('jose')
- end
- end
- context "that's marked as completed but not expired" do
- setup do
- @attempt = attempts(:completed)
- end
- should "return false when sent #expired?" do
- assert !@attempt.expired?
- end
- should "return true when sent #started?" do
- assert @attempt.started?
- end
- should "not be accessible" do
- assert !@attempt.accessible?('jose')
- end
- end
- end
- end
- ## Fixture
- expired:
- exam_section: spanish_lpe
- completed: 0
- student_id: jose
- expires_at: <%= 5.minutes.ago.to_s(:db) %>
- started_at: <%= 30.minutes.ago.to_s(:db) %>
- permalink: 0f76908e50aa38152901782355f0ec07
- completed:
- exam_section: spanish_lpe
- completed: 1
- student_id: jose
- expires_at: <%= 5.minutes.from_now.to_s(:db) %>
- started_at: <%= 30.minutes.ago.to_s(:db) %>
- permalink: 0f76908e50aa38152901782355f0ec07
Add Comment
Please, Sign In to add comment