Sha256: 5e9753e59f2bcf98ab1866a388f625e2b254e3bd04294624db0efde77c19dafe

Contents?: true

Size: 886 Bytes

Versions: 1

Compression:

Stored size: 886 Bytes

Contents

require 'net/http'
require 'open3'


Given /^I am on the target install directory$/ do
  @ginst_path = create_temp_dir
end


Then /^I should see "([^\"]*)" file$/ do |file|
  in_dir(@ginst_path || Ginst::Ginst.working_dir) do 
    File.exists?(file).should be
  end
end

When /^I (.*) the server$/ do |action|
  server_cmd = File.expand_path(File.join(File.dirname(__FILE__),%w[.. .. bin ginst]))
  in_dir(@ginst_path) do
    stding, stdout, stderr = Open3.popen3("#{server_cmd} #{action}")
    [stdout.read, stderr.read]
  end
  $?.to_i.should == 0
  sleep 5
end

Then /^I should be able to access the webserver$/ do
  lambda{ Net::HTTP.get_response('127.0.0.1','/',4567).code.to_i.should == 200 }.should_not raise_error
end


Then /^I should not be able to access the webserver$/ do
  lambda{ Net::HTTP.get_response('127.0.0.1','/',4567) }.should raise_error(Errno::ECONNREFUSED)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ginst-0.2.2 features/step_definitions/manage_server_steps.rb