Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 789b8c1d68
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (37 sloc) 0.98 kb
module WebFixtures
Version = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))
def self.generate(&block)
WebFixtures::Base.new(&block).run!
end
class Base < Array
attr_accessor :filename
def initialize(filename = nil, &block)
@filename = filename
@block = block
end
def dsl
@dsl ||= WebFixtures::DSL.new(self)
end
def run!
if @block
dsl.instance_eval(&@block)
else
dsl.instance_eval(File.read(filename), filename)
end
store!
return 0
rescue Exception
return 1
end
def store!
credentials = {}
self.each do |request|
request.username = credentials[:username] if credentials[:username]
request.password = credentials[:password] if credentials[:password]
request.store!
credentials[:username] = request.username
credentials[:password] = request.password
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.