| z, ? | toggle help (this) |
| space, → | next slide |
| shift-space, ← | previous slide |
| d | toggle debug mode |
| ## <ret> | go to slide # |
| c, t | table of contents (vi) |
| f | toggle footer |
| g | toggle follow |
| r | reload slides |
| n | toggle notes |
| p | run preshow |
| P | toggle pause |
| s | choose style |
$ gem install rspec
...
5 gems installed$ rspec --init
create spec/spec_helper.rb
create .rspecrequire 'spec_helper'
describe "our Product" do
# test-cases here
enddescribe "our Product" do
it "has a nonzero price"
enddescribe Product do
it "has a nonzero price"
enddescribe Product do
it "has a default price" do
product = Product.new
product.price.should == 10
end
enddescribe Product do
it "is available by default" do
product = Product.new
product.available.should == true
product.available.should be_true
product.should be_available
end
enddescribe Product do
it "has many variants"
it "belongs to category" do
pending
product.category should_not be_nil
end
xit "has weight" do
product.weight should_not be_nil
end
enddescribe Product do
let(:product) { Product.new }
it "has a default price" do
product.price.should == 10
end
enddescribe Product do
describe "showing let in action" do
let(:product) { Product.new }
describe "describe can be nested" do
let(:products) {[product, product]}
it "has a default price" do
products[0].price.should == 10
end
end
end
endgem 'rspec-rails'require 'spec_helper'
describe Product do
it "is invalid without a name" do
product = Product.new
product.should_not be_valid
end
end