Skip to content

Instantly share code, notes, and snippets.

@diabolo
Created July 13, 2012 05:00
Show Gist options
  • Save diabolo/3102828 to your computer and use it in GitHub Desktop.
Save diabolo/3102828 to your computer and use it in GitHub Desktop.
Don't use variables in step_defs
require 'rubygems'
require 'mechanize'
require 'json'
module ApiExtensions
@agent = Mechanize.new
@api_header = {'Accept' => 'application/json', 'Content-Type' => 'application/json'}
@api_uris = {
'the list of campuses' => 'http://example.com/servicehosts/campus.svc',
'the list of settings' => 'http://example.com/servicehosts/setting.svc',
'login' => 'http://example.com/servicehosts/Student.svc/login',
}
# some methods
end
World(ApiExtensions)
require 'rubygems'
require 'mechanize'
require 'json'
module ApiExtensions
def mechanize_agent
Mechanize.new
end
def api_json_header
{'Accept' => 'application/json', 'Content-Type' => 'application/json'}
end
def api_uris
{
'the list of campuses' => 'http://example.com/servicehosts/campus.svc',
'the list of settings' => 'http://example.com/servicehosts/setting.svc',
'login' => 'http://example.com/servicehosts/Student.svc/login',
}
end
# some methods
end
World(ApiExtensions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment