class SPV::Fixture

Keeps a path to a fixture and options which should be passed to Vcr while inserting a cassette

Attributes

options[RW]
path[RW]

Public Class Methods

new(name, vcr_options = {}) click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 9
def initialize(name, vcr_options = {})
  path = Pathname.new(name)

  @fixture_name = path.basename
  @path         = path.dirname
  @options      = vcr_options
end

Public Instance Methods

clean_name() click to toggle source

Returns a name without a link to a home path

# File lib/site_prism_vcr/fixture.rb, line 41
def clean_name
  @fixture_name.to_path
end
name() click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 17
def name
  (self.path + @fixture_name).to_path
end
path=(val) click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 21
def path=(val)
  @path = Pathname.new(val)
end
prepend_path(val) click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 25
def prepend_path(val)
  self.path = Pathname.new(val) + self.path
end
set_home_path(path_to) click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 29
def set_home_path(path_to)
  self.path = self.path.to_path.gsub(
    /\A(\:#{self.shortcut_path}\/|:#{self.shortcut_path}|\~\/|\~)/,
    path_to
  )
end
shortcut_path() click to toggle source
# File lib/site_prism_vcr/fixture.rb, line 36
def shortcut_path
  res = (self.name.match(/:(\w+)\//) || self.name.match(/(~)\//)) and res[1]
end