class SPV::Fixtures::Modifiers::Path

It takes a fixture and adds a path to it.

Public Instance Methods

modify(fixture) click to toggle source
# File lib/site_prism_vcr/fixtures/modifiers/path.rb, line 8
def modify(fixture)
  if shortcut = fixture.shortcut_path
    raise ShortcutPathError.new(
      "You cannot use a shortcut path while listing fixtures in the 'path' method. " <<
      "Please, use 'fixtures' method for '#{fixture.clean_name}' fixture or " <<
      "you can additionally use the 'path' method where you will specify a shortcut path as a path name." <<
      "Example: path(':#{shortcut}', ['#{fixture.clean_name}'])"
    )
  else
    path = @options.path
    path = path + '/' unless path[-1, 1] == '/'

    fixture.prepend_path(path)
  end
end