Module: ElabsMatchers::Helpers::Fixtures

Defined in:
lib/elabs_matchers/helpers/fixtures.rb

Instance Method Summary collapse

Instance Method Details

#fixture_file(path) ⇒ Object

Opens a file from the fixtures directory.

Example: fixture_file(“file.txt”)

Parameters:

  • path (String)

    A file name, relative to the fixtures folder.



15
16
17
18
# File 'lib/elabs_matchers/helpers/fixtures.rb', line 15

def fixture_file(path)
  root = if defined?(Rails) then Rails.root else "../../../spec/" end
  File.open(File.expand_path("#{root}/fixtures/#{path}", File.dirname(__FILE__)))
end