Tested on Rails 2.3.4 and Rack 1.0.
Here's the middleware code:
class SetCookieDomain
def initialize(app, default_domain)
@app = app
@default_domain = default_domain
Person = Struct.new(:id, :name, :phone_number) | |
DataSource = Struct.new(:people) do | |
def find_by_id(id) | |
people.detect { |p| p.id == id } | |
end | |
def person(id, &block) | |
p = find_by_id(id) | |
block.call(p) if p && block |
# username = "my_username" | |
# pwd = "my_password" | |
# target_path = "my_target_path" | |
# saving auth cookie | |
system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \ | |
https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027} | |
(25..600).each do |i| |
require 'minitest/autorun' | |
class StringCalculator | |
def self.add(string) | |
if string.empty? | |
0 | |
else | |
match_data = string.match(/^\/\/(.+)\n/) | |
if match_data.nil? | |
separator = /(,|\n)/ |
// casperjs version 1.1.0 | |
casper.test.begin('Edicola CDS', 2, function suite(test) { | |
casper.start('http://edicola.corrieredellosport.it', function() { | |
console.log('location is ' + this.getCurrentUrl()); | |
test.assertTitle("Login al portale - Corriere dello Sport.it"); | |
this.fill('form#theFormLogin', { | |
USERNAME: "[email protected]", |
#! /bin/bash | |
start=$SECONDS | |
end=$((SECONDS+5)) | |
while [ $SECONDS -lt $end ]; do | |
casperjs test browse_cms.js & | |
# ./bin/phantomjs examples/loadspeed.coffee http://cmsite-uat.herokuapp.com/sites/1 & | |
# ./bin/phantomjs examples/loadspeed.coffee http://cmsite-uat.herokuapp.com/sites/2 & | |
# ./bin/phantomjs examples/loadspeed.coffee http://cmsite-uat.herokuapp.com/sites/5 & | |
sleep 0.5 |
var casper = require('casper').create({ | |
pageSettings: { | |
userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0' | |
} | |
}); | |
casper.test.begin('CMSite', 1, function suite(test) { | |
casper.start('http://cmsite-uat.herokuapp.com/sites/5', function() { | |
this.waitForUrl(/cmsite-uat\.herokuapp\.com\/sites\/5\/site_rules/, |
title Coupon purchase process | |
ClientBrowser->+Vetrina: Purchase deal | |
note right of ClientBrowser: 10 Giorni alle Terme di Merano | |
Vetrina->DataPower: call PurchaseDeal API | |
note right of Vetrina: | |
dealId, | |
amount, | |
buyer email |
# Formatting constants | |
export BOLD=`tput bold` | |
export UNDERLINE_ON=`tput smul` | |
export UNDERLINE_OFF=`tput rmul` | |
export TEXT_BLACK=`tput setaf 0` | |
export TEXT_RED=`tput setaf 1` | |
export TEXT_GREEN=`tput setaf 2` | |
export TEXT_YELLOW=`tput setaf 3` | |
export TEXT_BLUE=`tput setaf 4` | |
export TEXT_MAGENTA=`tput setaf 5` |