v. 3.0.0
- created, ignoring all previous incarnations of the rules, from draft of an email
v 3.0.1
- Clarifications
beforeEach(function() { | |
this.addMatchers({ | |
toBeA: function(expected) { return this.env.equals_(this.actual, jasmine.any(expected)); } | |
}); | |
}); |
#! /usr/bin/env ruby | |
raise "Argument to 'take' not specfied.\n\n\tUsage: take [dump]\n" if ARGV.length == 0 | |
module Take | |
class BathroomClosedForCleaningError < RuntimeError; end | |
end | |
case ARGV[0].downcase | |
when 'dump' | |
remarks = [] |
class FakeSocketClient < EventMachine::Connection | |
attr_writer :onopen, :onclose, :onmessage | |
attr_reader :data | |
def initialize | |
@state = :new | |
@data = [] | |
end |
describe "opening a socket connection" do | |
it "should add players to game if available and respond READY" do | |
EM.run { | |
server = Server.new(:host => '0.0.0.0', :port => 12345) | |
server.start | |
# opens the socket client connection | |
socket = EM.connect('0.0.0.0', 12345, FakeSocketClient) | |
EM.run { | |
# our fantastic eventmachine code | |
} |
class Server | |
def start | |
EM.run { | |
EM.start_server @host, @port, Client::Socket, :app => self do |players| | |
@players << player | |
player.send_data("READY\r\n") | |
end |
<% autoescape do %> | |
<div> | |
<%= content_helper_gets_escaped %> | |
</div> | |
<% end %> |
module EventMachine | |
module WebSocket | |
class MaskedString < String | |
def read_mask | |
raise "Too short" if bytesize < 4 # TODO - change | |
@masking_key = String.new(self[0..3]) | |
end |
require 'rubygems' | |
require 'test/unit' | |
require 'watir-webdriver' | |
class LoginTest < Test::Unit::TestCase | |
def setup | |
@browser = Watir::Browser.new :ff | |
end |