Class: CmQuiz::Review::BaseReview

Inherits:
Object
  • Object
show all
Includes:
CmQuiz::ReviewHelper
Defined in:
lib/cm_quiz/review/base_review.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CmQuiz::ReviewHelper

#be, #be_nil, #be_within, #eq, #expect

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/cm_quiz/review/base_review.rb', line 6

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/cm_quiz/review/base_review.rb', line 6

def path
  @path
end

#verbObject (readonly)

Returns the value of attribute verb.



6
7
8
# File 'lib/cm_quiz/review/base_review.rb', line 6

def verb
  @verb
end

Instance Method Details

#build_test_result(test_case, passed = true, message = nil) ⇒ Object



22
23
24
# File 'lib/cm_quiz/review/base_review.rb', line 22

def build_test_result(test_case, passed = true, message = nil)
  [test_case, passed, message]
end

#performObject



9
10
11
12
13
14
15
16
# File 'lib/cm_quiz/review/base_review.rb', line 9

def perform
  run
  build_test_result(test_request)
rescue RSpec::Expectations::ExpectationNotMetError => e
  build_test_result(test_request, false, e.message)
rescue => e
  build_test_result(test_request, false, e.message)
end

#runObject



18
19
20
# File 'lib/cm_quiz/review/base_review.rb', line 18

def run
  raise "Method `run` should be implemented on class #{self.class}"
end

#test_requestObject



26
27
28
29
30
31
32
# File 'lib/cm_quiz/review/base_review.rb', line 26

def test_request
  {
    verb: @verb,
    path: @path,
    options: @options
  }
end