save_and_open_page
have_button(locator)
# Override `Backbone.ajax` to queue all requests. | |
# Cache Backbone ajax function, by default, just $.ajax | |
_ajax = Backbone.ajax | |
# Override Backbone.ajax to queue all requests to prevent | |
# lost updates. | |
Backbone.ajax = (options) -> | |
@ajax.queue options |
def select2_select(text, options) | |
page.find("#s2id_#{options[:from]} a").click | |
page.all("ul.select2-results li").each do |e| | |
if e.text == text | |
e.click | |
return | |
end | |
end | |
end |
require.config({ | |
baseUrl: '/backbone-tests/', | |
paths: { | |
'jquery' : '/app/libs/jquery', | |
'underscore' : '/app/libs/underscore', | |
'backbone' : '/app/libs/backbone', | |
'mocha' : 'libs/mocha', | |
'chai' : 'libs/chai', | |
'chai-jquery' : 'libs/chai-jquery', | |
'models' : '/app/models' |
class Feature < Test::Unit::TestCase | |
include Capybara::DSL, FactoryGirl::Syntax::Methods | |
def teardown | |
Capybara.reset_sessions! | |
Capybara.use_default_driver | |
end | |
add_teardown_hook do |context| | |
context.instance_eval do |
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1 |
//==== Simple SCSS mixin to create CSS triangles | |
//==== Example: @include css-triangle ("up", 10px, #fff); | |
@mixin css-triangle ($direction: "down", $size: 20px, $color: #000) { | |
width: 0; | |
height: 0; | |
border-left: $size solid #{setTriangleColor($direction, "left", $color)}; | |
border-right: $size solid #{setTriangleColor($direction, "right", $color)}; | |
border-bottom: $size solid #{setTriangleColor($direction, "bottom", $color)}; | |
border-top: $size solid #{setTriangleColor($direction, "top", $color)}; | |
} |
# Reference Backbone ajax function | |
_ajax = Backbone.ajax | |
requestQueue = [] | |
requestPending = false | |
sendRequest = (options, promise, trigger=true) -> | |
options = _.clone options | |
if trigger | |
requestPending = true |
<?php | |
/** | |
* PHPUnit | |
* | |
* Copyright (c) 2001-2012, Sebastian Bergmann <[email protected]>. | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: |
Ext.Date.fuzzy = function(time, local){ | |
(!local) && (local = Date.now()); | |
if (typeof time !== 'number' || typeof local !== 'number') { | |
return; | |
} | |
var | |
offset = Math.abs((local - time)/1000), |