Skip to content

Instantly share code, notes, and snippets.

Jan Dudek jdudek

Block or report user

Report or block jdudek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View return-deferred.coffee
jasmine.Spy.prototype.andReturnDeferred = ->
@deferreds = []
@resolve = =>
unless @deferreds.length > 0
throw "Cannot resolve, #{@identity} was not called"
dfr = @deferreds.shift()
dfr.resolve()
@reject = =>
unless @deferreds.length > 0
throw "Cannot reject, #{@identity} was not called"
@jdudek
jdudek / bbq_java.rb
Created Feb 8, 2012 — forked from paneq/bbq_java.rb
bbq factories
View bbq_java.rb
class Session
# some kind of delegator is needed here
# delegate everything to @session
def initialize(options)
@session = Capybara::Session.new(options[:driver], Bbq.app)
end
def kill
page.driver.quit if page.driver.browser?
@jdudek
jdudek / gist:1539919
Created Dec 30, 2011
Clock in JS tests
View gist:1539919
class Countdown
constructor: (@clock, @seconds) ->
$.extend(this, new Observable)
@finished = false
start: =>
fn = =>
this.trigger("updated", @seconds)
@seconds--
if @seconds >= 0
@jdudek
jdudek / gist:1485824
Created Dec 16, 2011
wait_for_server in Bbq
View gist:1485824
class TestUser
def wait(seconds)
sleep seconds.to_i
end
def wait_for_server(timeout = 10.seconds)
page.wait_until(timeout.to_i) do
page.evaluate_script 'jQuery.active == 0'
end
end
View playing_game_test.rb
require File.dirname(__FILE__) + "/../test_helper"
class PlayingGameTest < Bbq::TestCase
include Bbq::SessionPool
background do
@admin = session_pool.create_user(TestUser, :driver => :selenium)
@admin.roles(:admin)
@admin.prepare_game_data
View zad1.rb
require 'gtk2'
require 'rubygems'
require 'dbi'
class Person
DB_FILE = 'db.sqlite'
@@db = nil
@@instances = []
@jdudek
jdudek / testing-rich-client-v2-pub.coffee
Created Nov 24, 2011
A few thoughts on testing rich-client applications (meet.js)
View testing-rich-client-v2-pub.coffee
# A few thoughts on testing rich-client applications
# Jan Dudek, Arkency
# We've created a game that has some animations, uses Facebook API. Almost no rendering on the server. Client-server communication through JSON REST API.
View game_screen_controller_spec.js.coffee
test = (suite) ->
self = {}
steps = []
last = null
run = (suite, steps) ->
return if steps.length == 0
[step, msg, fn] = steps.shift()
if step == describe
describe.call suite, msg, ->
@jdudek
jdudek / game_api_test.rb
Created Sep 13, 2011
Testing REST API using BBQ
View game_api_test.rb
require File.dirname(__FILE__) + "/../test_helper"
class GameApiTest < Bbq::TestCase
background do
@admin = TestUser.new
@admin.roles(:admin)
@admin.prepare_game_data
@client = TestClient.new
@client.extend(TestClient::GameClient)
You can’t perform that action at this time.