Created
October 2, 2018 12:06
-
-
Save charger/8d1f47a75cec2a6cc93789c05f399965 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/spec/support/the_service.rb | |
#ensure that after all specs TheService will be stopped | |
RSpec.configure do |config| | |
config.after :suite do | |
TheServiceControl.stop | |
end | |
end | |
class TheServiceControl | |
class << self | |
@pid = nil | |
@config = nil | |
def config | |
puts "Please create file: #{config_path}" unless File.exist?(config_path) | |
@config = YAML.load_file(config_path) | |
end | |
def host | |
TheServiceControl.config['server']['addr'] | |
end | |
def config_path | |
Rails.root.join('spec', 'support', 'the_service_config.yml') | |
end | |
def start | |
# will be described below | |
end | |
def stop | |
# will be described below | |
end | |
def post(params, headers) | |
HTTParty.post("http://#{host}/request", body: params, headers: headers ) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment