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
describe Card do | |
describe "#value" do | |
context "Two of Hearts" do | |
subject { Card.new("2H") } | |
its(:value) { should == 2 } | |
end | |
describe "Face Cards" do | |
context "King of Clubs" do |
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
$(".log a").click(function() { | |
$("#panel-" + $(this).data("build_id") + ":hidden").trigger('showLog'); | |
$("#panel-" + $(this).data("build_id") + ":visible").trigger('hideLog'); | |
return false; | |
}); |
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
rvm @capybara-example --create | |
gem install bundler | |
gem install rails -v 3.0.7 | |
rails new example | |
cd example | |
echo 'gem "rspec-rails", "2.6.0.rc4", :group => [:development, :test]' >> Gemfile | |
echo 'gem "capybara", "1.0.0.beta1", :group => [:development, :test]' >> Gemfile | |
bundle install | |
rails g rspec:install | |
rails g scaffold things |
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
WidgetsController | |
GET index | |
assigns all widgets as @widgets | |
GET show | |
assigns the requested widget as @widget | |
GET new | |
assigns a new widget as @widget | |
GET edit | |
assigns the requested widget as @widget | |
POST create |
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
$ ruby -v && time bundle exec rspec spec | |
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.6.0] | |
Finished in 2.53 seconds | |
669 examples, 0 failures, 2 pending | |
real 0m3.861s | |
user 0m3.397s | |
sys 0m0.405s |
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 install rspec-rails --pre --debug | |
Exception `NameError' at /Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:163 - uninitialized constant Gem::Commands::InstallCommand | |
Exception `LoadError' at /Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- psych | |
Exception `LoadError' at /Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35 - no such file to load -- psych | |
Exception `NoMethodError' at /Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:134 - undefined method `call' for nil:NilClass | |
ERROR: While executing gem ... (NoMethodError) | |
undefined method `call' for nil:NilClass | |
/Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:134:in `satisfied_by?' | |
/Users/david/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `all?' | |
/Users/david/.rvm/rubies/ruby-1 |
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
module Test | |
module Unit | |
TestCase = RSpec::Core::ExampleGroup | |
end | |
end | |
class Test::Unit::TestCase | |
def self.inherited(host) | |
host.set_it_up host.name.gsub(/(Spec|Test)/,'') | |
def host.method_added(name) |
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
describe Subscription do | |
describe '#api_representation' do | |
let(:record) { new_valid_record } | |
before(:each) do | |
record.engine_variants.first.should respond_to(:api_representation) | |
record.engine_variants.first.stub(api_representation: 'ev_api_representation') | |
record.url_fragments.first.should respond_to(:api_representation) | |
record.url_fragments.first.stub(api_representation: 'uf_api_representation') |
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
require 'active_model' | |
require 'active_support/core_ext' | |
require 'rspec/rails/mocks' | |
describe "Foo" do | |
it "is mockable" do | |
foo = mock_model("Foo") | |
foo.id.should eq(1001) | |
foo.to_param.should eq("1001") | |
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
# ------------------------------------- | |
# DECLARATION | |
# using strings for explicit inclusion | |
shared 'logged in as admin' do | |
before { login_as admin_user } | |
end | |
shared 'a model with a slug' do | |
it 'sets the slug column upon initialization' do |