class Alephant::Preview::FixtureLoader
Attributes
base_path[R]
current_fixture[R]
fixtures[R]
Public Class Methods
new(base_path)
click to toggle source
# File lib/alephant/preview/fixture_loader.rb, line 6 def initialize(base_path) @base_path = base_path @fixtures = Dir.glob("#{base_path}/fixtures/*") end
Public Instance Methods
get(_uri)
click to toggle source
# File lib/alephant/preview/fixture_loader.rb, line 11 def get(_uri) OpenStruct.new( status: 200, body: fixture ) end
Protected Instance Methods
fixture()
click to toggle source
# File lib/alephant/preview/fixture_loader.rb, line 20 def fixture path = fixtures.shift raise "There isn't a fixture matching the request call, please add one" if path.nil? File.open(path).read end