Guest User

Untitled

a guest
Apr 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/../test_helper'
  2.  
  3. class AttemptTest < ActiveSupport::TestCase
  4.  
  5. fixtures :attempts, :exam_sections
  6.  
  7. context "An Attempt instance" do
  8.  
  9. context "that's expired but not completed" do
  10. setup do
  11. @attempt = attempts(:expired)
  12. end
  13.  
  14. should "return false when sent #expired?" do
  15. assert @attempt.expired?
  16. end
  17.  
  18. should "return true when sent #started?" do
  19. assert @attempt.started?
  20. end
  21.  
  22. should "not be accessible" do
  23. assert !@attempt.accessible?('jose')
  24. end
  25. end
  26.  
  27. context "that's marked as completed but not expired" do
  28. setup do
  29. @attempt = attempts(:completed)
  30. end
  31.  
  32. should "return false when sent #expired?" do
  33. assert !@attempt.expired?
  34. end
  35.  
  36. should "return true when sent #started?" do
  37. assert @attempt.started?
  38. end
  39.  
  40. should "not be accessible" do
  41. assert !@attempt.accessible?('jose')
  42. end
  43. end
  44.  
  45. end
  46.  
  47. end
  48.  
  49.  
  50. ## Fixture
  51.  
  52. expired:
  53. exam_section: spanish_lpe
  54. completed: 0
  55. student_id: jose
  56. expires_at: <%= 5.minutes.ago.to_s(:db) %>
  57. started_at: <%= 30.minutes.ago.to_s(:db) %>
  58. permalink: 0f76908e50aa38152901782355f0ec07
  59.  
  60. completed:
  61. exam_section: spanish_lpe
  62. completed: 1
  63. student_id: jose
  64. expires_at: <%= 5.minutes.from_now.to_s(:db) %>
  65. started_at: <%= 30.minutes.ago.to_s(:db) %>
  66. permalink: 0f76908e50aa38152901782355f0ec07
Add Comment
Please, Sign In to add comment