Sha256: 0f9dd65648d5f3aefb428a0349988becf926a383c83e36566529f7684f4078da

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

require_relative 'base'

module SPV
  class Fixtures
    module Modifiers
      # It takes a fixture and replaces a shortcut path with
      # a full path to it.
      class ShortcutPath < Base
        def modify(fixture)
          if shortcut = fixture.shortcut_path
            if path = @options.shortcut_path(shortcut)
              fixture.set_home_path(path)
            else
              raise ArgumentError.new(
                "You are trying to use the '#{shortcut}' shortcut path for #{fixture.name} fixture. " \
                "This shortcut path cannot be used since it is not defined, please refer to the documentation " \
                "to make sure you properly define the shortcut path."
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
site_prism.vcr-0.3.0 lib/site_prism_vcr/fixtures/modifiers/shortcut_path.rb
site_prism.vcr-0.2.0 lib/site_prism_vcr/fixtures/modifiers/shortcut_path.rb