Sha256: eb0c6db1f22aa8a9c0541e440e6a893d4b09dcbbf39b37caa05456559ee6bfea

Contents?: true

Size: 773 Bytes

Versions: 8

Compression:

Stored size: 773 Bytes

Contents

require 'fitting/report/responses'

module Fitting
  module Report
    class Action
      def initialize(action)
        @action = action
        @responses = Fitting::Report::Responses.new(@action.responses)
        @cover = false
      end

      def cover?
        @cover
      end

      def cover!
        @cover = true
      end

      def method
        @action.method
      end

      def path
        @action.path.to_s
      end

      attr_reader :responses, :tests

      def path_match(find_path)
        regexp =~ find_path
      end

      def regexp
        return @regexp if @regexp

        str = Regexp.escape(path)
        str = str.gsub(/\\{\w+\\}/, '[^&=\/]+')
        str = "\\A#{str}\\z"
        @regexp = Regexp.new(str)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fitting-4.2.1 lib/fitting/report/action.rb
fitting-4.2.0 lib/fitting/report/action.rb
fitting-4.1.0 lib/fitting/report/action.rb
fitting-4.0.4 lib/fitting/report/action.rb
fitting-4.0.3 lib/fitting/report/action.rb
fitting-4.0.2 lib/fitting/report/action.rb
fitting-4.0.1 lib/fitting/report/action.rb
fitting-4.0.0 lib/fitting/report/action.rb