Sha256: bd8a3ccc68fc0b8b3d7bb1a1159068d5cc65cf3e4b04d1c1ca777d22a7214905

Contents?: true

Size: 785 Bytes

Versions: 10

Compression:

Stored size: 785 Bytes

Contents

require 'rr'

module Riot
  module RR

    class Situation < Riot::Situation
      include ::RR::Adapters::RRMethods
    end # Situation

    class Assertion < Riot::Assertion
      def run(situation)
        result = super
        situation.verify
        result
      rescue ::RR::Errors::RRError => e
        result.first == :pass ? [:fail, e.message.gsub(/\n/, " ")] : result
      ensure
        situation.reset
      end
    end # Assertion

    module ContextHelpers
    private
      def assertion_class; Riot::RR::Assertion; end
      def situation_class; Riot::RR::Situation; end
    end # ContextHelpers

    def self.enable(context_class)
      context_class.instance_eval { include Riot::RR::ContextHelpers }
    end

  end # RR
end # Riot

Riot::RR.enable(Riot::Context)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
riot-0.12.1 lib/riot/rr.rb
riot-0.12.0 lib/riot/rr.rb
riot-0.12.0.pre lib/riot/rr.rb
riot-0.11.4 lib/riot/rr.rb
riot-0.11.4.pre lib/riot/rr.rb
riot-0.11.3 lib/riot/rr.rb
riot-0.11.2 lib/riot/rr.rb
riot-0.11.1 lib/riot/rr.rb
riot-0.11.0 lib/riot/rr.rb
riot-0.10.13 lib/riot/rr.rb