This file contains 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
# Needs Ruby 1.8.7 | |
# gem install hipchat | |
# gem install xmpp4r-simple | |
# gem install daemons | |
# run with ruby zentc_to_hipchat.rb start | |
require 'rubygems' | |
require 'hipchat' | |
require 'xmpp4r-simple' |
This file contains 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
require 'spec_helper' | |
#Note that while this spec is quite sexy, it shouldn't be taken too far | |
#this syntax hides deeper meaning that may very well be important. | |
#I'm using this for a quick spike and I think it's acceptable in certain | |
#scenarios, but use with caution! Don't get distracted by the shiny... | |
describe User do | |
its(:user_profile) { should be } | |
end |
This file contains 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 :development, :test do | |
# gem 'webrat' | |
gem 'autotest-rails' | |
gem 'autotest-growl' | |
gem "rspec-core", :git => "git://github.com/rspec/rspec-core.git" | |
gem "rspec-rails", '~> 2.4.1' | |
gem 'rr' | |
gem "spork", :git => "git://github.com/timcharper/spork.git" | |
gem "guard-spork" | |
gem "rb-fsevent" |
This file contains 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
# A sample Guardfile | |
# More info at http://github.com/guard/guard#readme | |
guard 'spork' do | |
watch('^config/application.rb$') | |
watch('^config/environment.rb$') | |
watch('^config/environments/.*\.rb$') | |
watch('^config/initializers/.*\.rb$') | |
watch('^spec/spec_helper\.rb$') | |
watch('^spec/factories\.rb$') |
This file contains 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
Autotest.add_hook(:initialize) {|at| | |
%w{.git .svn .hg .swp .DS_Store ._* tmp}.each do |exception| | |
at.add_exception(exception) | |
end | |
at.clear_mappings # take out the default (test/test*rb) | |
at.add_mapping(%r%^(spec|third_party)/.*_spec.rb$%) { |filename, _| | |
filename | |
} |
This file contains 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
# /lib/tasks/rspec.rake | |
namespace :fork do | |
task :spec do | |
fork do | |
RSpec::Core::Runner.disable_autorun! | |
RSpec::Core::Runner.run(['spec'], $stderr, $stdout) ? exit(0) : exit(1) | |
end | |
Process.wait | |
raise 'rspec failed' unless $?.exitstatus == 0 | |
# exiting the fork can cause MySql to drop the connection |
This file contains 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
task :teamcity => ['teamcity:clean', 'teamcity:setup', 'barista:brew', 'fork:spec', 'teamcity:cucumber', 'jasmine:ci'] | |
namespace :teamcity do | |
task :setup do | |
RAILS_ENV = 'test' | |
Rake::Task['db:drop'].invoke | |
Rake::Task['db:create'].invoke | |
Rake::Task['db:schema:load'].invoke | |
end |
This file contains 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
var z="http://gist.github.com/",y=document.write,x=$("body"),w=$("p.gist").map(function(b,a){a=$(a);var c=$("a",a),u=c.attr("href");if(c.length&&u.indexOf(z)==0)return{p:a,id:u.substring(z.length)}}).get(),v=function(){if(w.length==0)document.write=y;else{var b=w.shift();document.write=function(){document.write=function(a){b.p.replaceWith(a);v()}};x.append('<scr'+'ipt src="'+z+b.id+'.js"></scr'+'ipt>')}};v(); |
This file contains 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
describe MyController do | |
let(:cookies) { mock('cookies') } | |
context "when my page is visited" do | |
it "should delete my cookie" do | |
controller.stub!(:cookies).and_return(cookies) | |
cookies.should_receive(:delete).with(cookie, :domain => '.mydomain.com') | |
get "my_action" |
This file contains 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
require 'rspec' | |
# is it really this simple? | |
RSpec::Matchers.define :have_received do |method_name| | |
match do |actual| | |
@args ||= [] | |
@method_name ||= method_name | |
actual.received_message?(@method_name, *@args) | |
end |