This file contains hidden or 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
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9 | |
# Don't load rspec if running "rake gems:*" | |
unless ARGV.any? {|a| a =~ /^gems/} | |
begin | |
require 'spec/rake/spectask' | |
rescue MissingSourceFile | |
module Spec | |
module Rake |
This file contains hidden or 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
fork {system 'echo "startup.sh"'} | |
# RSpec | |
require 'spec/expectations' | |
require 'webrat/selenium' | |
Webrat.configure do |config| | |
config.mode = :selenium | |
config.application_address = 'localhost' | |
config.application_port = 8080 |
This file contains hidden or 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
testRegistrationIsValidRunsAllValidationsWhenCallingIsValid: function() {with(this) { | |
callCountOne = 0; | |
callCountTwo = 0; | |
var mockFunOne = function() { callCountOne++; console.log(callCountOne); }; | |
console.log(callCountOne.toString() + 'a'); | |
var mockFunTwo = function() { this.callCountTwo++; }; | |
testObject.registerValidation(mockFunOne, this); | |
testObject.registerValidation(mockFunTwo, this); | |
This file contains hidden or 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
class BackgroundChanger | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, response = @app.call(env) | |
response.body.gsub!('<body',"<body background='/images/common/bg-staging.gif'") if env['RAILS_ENV'] != 'production' && response.respond_to?(:body) && response.body.respond_to?(:gsub!) | |
[status, headers, response] | |
end |
This file contains hidden or 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
(function($){ | |
$.worldClock = function(clockElement, opts) { | |
var settings =$.extend( {}, $.worldClock.defaults, opts, getMetadata(clockElement)); | |
return setInterval((function() { | |
updateClock(clockElement, settings); | |
return arguments.callee; | |
})(), settings.interval); | |
}; | |
$.worldClock.defaults = { |
This file contains hidden or 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
map = function () { | |
emit(this.id, this.version); | |
} | |
reduce = function (key, values) { | |
return Math.max.apply(Math, values); | |
} | |
fin = function(key, value) { | |
return db.oplan.findOne({id:key, version:value}); |
This file contains hidden or 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
undefined method `match' for nil:NilClass | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/activesupport-3.0.0.rc/lib/active_support/whiny_nil.rb:48:in `method_missing' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:61:in `extract_path_and_options' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:42:in `initialize' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:231:in `new' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:231:in `match' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:396:in `match' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:746:in `match' | |
/Users/amos/.rvm/gems/ruby-head@rails3/gems/actionpack-3.0.0.rc/lib/action_dispatch/routing/mapper.rb:307:in `map_method' | |
/Users/amos/.rvm |
This file contains hidden or 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
bundle show | grep spec | |
* rspec (2.0.0.beta.20) | |
* rspec-core (2.0.0.beta.20) | |
* rspec-expectations (2.0.0.beta.20) | |
* rspec-mocks (2.0.0.beta.20) | |
* rspec-rails (2.0.0.beta.20) |
This file contains hidden or 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
group :test do | |
gem 'shoulda', '~>2.11' | |
gem 'rspec-rails', '~>2.0.0.beta' | |
end |
This file contains hidden or 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
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
require 'shoulda' |