This file contains 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
When /^I enter "([^\"]*)"$/ do |value| | |
find( "//*[@class = 'current']//input" ).set( value ) | |
find( "//*[@class = 'current']//input" ).value.should == value | |
end |
This file contains 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
# Rob's fix to dump in my_env.rb | |
class Capybara::Driver::Selenium::Node | |
def set( value ) | |
if tag_name == 'input' and type == 'radio' | |
node.select | |
elsif tag_name == 'input' and type == 'checkbox' | |
node.toggle | |
else | |
node.clear |
This file contains 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
# features/support/my_env.rb | |
def enter_text( input, text ) | |
input.node.clear | |
input.node.send_keys( text.to_s ) | |
end | |
# features/steps/feature_steps.rb | |
When /^I enter "([^\"]*)"$/ do |value| | |
enter_text( "//*[@class = 'current']//input", value ) |
This file contains 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
# Again, the text() method wouldn't give me what I wanted, so I came up with this to get at it (and to remove any | |
# whitespace either side of it). | |
# Used like: | |
# find( "//a[@id = 'messages']" ).should contain_text( "Review Your Messages" ) | |
class ContainText | |
def initialize( text ) | |
@text = text |
This file contains 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
# My page wrote alert p elements to the body (due to a hack to allow alerts in my app that wouldn't upset cuke flow), | |
# but iterating through them with all() didn't work, as when I called the text() method, it returned nil, even though | |
# there was text there -- so I used this instead. | |
# | |
# Get all alert p's off the page and dump their contents. | |
# | |
def _dump_alerts | |
doc = Nokogiri.HTML( page.body ) | |
doc.xpath( "//p[@class = 'alert']" ).reverse.each do |p| |
This file contains 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
----------- vendor/gems/troelskn-handsoap-0.5.7/lib/handsoap/http.rb ----------- | |
index 7a111fd..d499c5f 100644 | |
@@ -419,7 +419,7 @@ module Handsoap | |
def self.parse_headers(raw) | |
header = Hash.new([].freeze) | |
field = nil | |
- raw.gsub(/^(\r\n)+|(\r\n)+$/, '').each {|line| | |
+ raw.gsub(/^(\r\n)+|(\r\n)+$/, '').split( /(\r\n)/ ).each {|line| | |
case line | |
when /^([A-Za-z0-9!\#$%&'*+\-.^_`|~]+):\s*(.*?)\s*\z/om |
This file contains 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
turc = TimesheetUploadRecordConverter.new( TimesheetUploadRecord.all ) | |
turc.perform |
This file contains 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
uri = URI.parse( "https://myapp.heroku.com" ) | |
http = Net::HTTP.new( uri.port, uri.host ) | |
http.use_ssl = true | |
request = Net::HTTP::Post.new( "/mobile_app/timesheet_uploads.json" ) | |
request["content-type"] = "application/json" | |
request.body = JSON.generate( { upload_data: upload_data } ) | |
request.basic_auth( MyConfig::USERNAME, MyConfig::PASSWORD ) | |
response = http.request( request ) | |
# last line creates this error: "getaddrinfo: nodename nor servname provided, or not known" |
This file contains 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
getaddrinfo: nodename nor servname provided, or not known | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:581:in `initialize' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:581:in `open' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:581:in `block in connect' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:44:in `timeout' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/timeout.rb:82:in `timeout' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:581:in `connect' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:574:in `do_start' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:563:in `start' | |
/Users/douglivesey/.rvm/ruby-1.9.1-p243/lib/ruby/1.9.1/net/http.rb:1094:in `request' |
This file contains 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
require "eventmachine" | |
require "evma_httpserver" | |
module Xena | |
class Server < EM::Connection | |
include EM::HttpServer | |
attr_accessor :signature, :thread |