Sha256: e004b3f4e7e321b2a9403ad43c208b8f193d63afece01f7c8567336b42c9e0f5

Contents?: true

Size: 790 Bytes

Versions: 6

Compression:

Stored size: 790 Bytes

Contents

require 'cm_quiz/review_helper'

module CmQuiz
  module Review
    class BaseReview
      attr_reader :verb, :path, :options
      include ReviewHelper

      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

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cm_quiz-0.0.8 lib/cm_quiz/review/base_review.rb
cm_quiz-0.0.7 lib/cm_quiz/review/base_review.rb
cm_quiz-0.0.6 lib/cm_quiz/review/base_review.rb
cm_quiz-0.0.5 lib/cm_quiz/review/base_review.rb
cm_quiz-0.0.4 lib/cm_quiz/review/base_review.rb
cm_quiz-0.0.3 lib/cm_quiz/review/base_review.rb