Sha256: 125b6b2c6d43f82f14b8cf80287e970ec8bb5f139fc87e156acf5bed1c8cb6cd
Contents?: true
Size: 1.71 KB
Versions: 4
Compression:
Stored size: 1.71 KB
Contents
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../../lib") require 'rubygems' require 'bundler/setup' Bundler.setup(:test) require 'mirage' require 'cucumber' require 'rspec' require 'mechanize' SCRATCH = './scratch' RUBY_CMD = RUBY_PLATFORM == 'JAVA' ? 'jruby' : 'ruby' module Web include Mirage::Web def get(url) browser = Mechanize.new browser.keep_alive= false browser.get(url) end def hit_mirage(url, parameters={}) start_time = Time.now file = parameters.values.find{|value| value.is_a?(File)} response = (file ? http_post(url, parameters) : http_get(url, parameters)) @response_time = Time.now - start_time response end def normalise text text.gsub(/[\n]/, ' ').gsub(/\s+/, ' ') end end module Regression def stop_mirage `export RUBYOPT='' && cd #{SCRATCH} && mirage stop` end def start_mirage `truncate mirage.log --size 0` `export RUBYOPT='' && cd #{SCRATCH} && mirage start` end end module IntelliJ include Mirage::Util def stop_mirage system "cd #{SCRATCH} && ../bin/mirage stop" wait_until do !$mirage.running? end end def start_mirage puts "starting mirage" `truncate mirage.log --size 0` system "cd #{SCRATCH} && ../bin/mirage start" wait_until do $mirage.running? end end end 'regression' == ENV['mode'] ? World(Regression) : World(IntelliJ) 'regression' == ENV['mode'] ? include(Regression) : include(IntelliJ) World(Web) Before do FileUtils.mkdir_p(SCRATCH) $mirage = Mirage::Client.new if $mirage.running? $mirage.clear else start_mirage end `cd #{SCRATCH}/ && ls | grep -v mirage.log | xargs rm -rf` `truncate -s 0 #{SCRATCH}/mirage.log` end at_exit do stop_mirage end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mirage-1.0.2 | features/support/env.rb |
mirage-1.0.1 | features/support/env.rb |
mirage-1.0.0 | features/support/env.rb |
mirage-0.1.7 | features/support/env.rb |