Skip to content

Commit

Permalink
Remove 'should' from example docstrings.
Browse files Browse the repository at this point in the history
- Closes rspec#162.
  • Loading branch information
justinko authored and dchelimsky committed Aug 14, 2010
1 parent 108e9bc commit 72ecc03
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions spec/rspec/rails/matchers/errors_on_spec.rb
@@ -1,23 +1,23 @@
require "spec_helper"

describe "error_on" do
it "should provide a description including the name of what the error is on" do
it "provides a description including the name of what the error is on" do
have(1).error_on(:whatever).description.should == "have 1 error on :whatever"
end

it "should provide a failure message including the number actually given" do
it "provides a failure message including the number actually given" do
lambda {
[].should have(1).error_on(:whatever)
}.should raise_error("expected 1 error on :whatever, got 0")
end
end

describe "errors_on" do
it "should provide a description including the name of what the error is on" do
it "provides a description including the name of what the error is on" do
have(2).errors_on(:whatever).description.should == "have 2 errors on :whatever"
end

it "should provide a failure message including the number actually given" do
it "provides a failure message including the number actually given" do
lambda {
[1].should have(3).errors_on(:whatever)
}.should raise_error("expected 3 errors on :whatever, got 1")
Expand Down
36 changes: 18 additions & 18 deletions spec/rspec/rails/mocks/stub_model_spec.rb
Expand Up @@ -3,70 +3,70 @@

describe "stub_model" do
describe "defaults" do
it "should have an id" do
it "has an id" do
stub_model(MockableModel).id.should be > 0
end

it "should say it is not a new record" do
it "says it is not a new record" do
stub_model(MockableModel).should_not be_new_record
end
end

it "should accept a stub id" do
it "accepts a stub id" do
stub_model(MockableModel, :id => 37).id.should == 37
end

it "should say it is a new record when id is set to nil" do
it "says it is a new record when id is set to nil" do
stub_model(MockableModel, :id => nil).should be_new_record
end

it "should accept any arbitrary stub" do
it "accepts any arbitrary stub" do
stub_model(MockableModel, :foo => "bar").foo.should == "bar"
end

it "should accept a stub for save" do
it "accepts a stub for save" do
stub_model(MockableModel, :save => false).save.should be(false)
end

describe "alternate primary key" do
it "should have the correct primary_key name" do
it "has the correct primary_key name" do
stub_model(AlternatePrimaryKeyModel).class.primary_key.should eql('my_id')
end

it "should have a primary_key" do
it "has a primary_key" do
stub_model(AlternatePrimaryKeyModel).my_id.should be > 0
end

it "should not say it is a new record" do
it "does not say it is a new record" do
stub_model(AlternatePrimaryKeyModel).should_not be_new_record
end

it "should say it is a new record if primary_key is nil" do
it "says it is a new record if primary_key is nil" do
stub_model(AlternatePrimaryKeyModel, :my_id => nil).should be_new_record
end

it "should accept a stub for the primary_key" do
it "accepts a stub for the primary_key" do
stub_model(AlternatePrimaryKeyModel, :my_id => 5).my_id.should == 5
end
end

describe "#as_new_record" do
it "should say it is a new record" do
it "says it is a new record" do
stub_model(MockableModel).as_new_record.should be_new_record
end

it "should have a nil id" do
it "has a nil id" do
stub_model(MockableModel).as_new_record.id.should be(nil)
end
end

it "should raise when hitting the db" do
it "raises when hitting the db" do
lambda do
stub_model(ConnectableModel).connection
end.should raise_error(RSpec::Rails::IllegalDataAccessException, /stubbed models are not allowed to access the database/)
end

it "should increment the id" do
it "increments the id" do
first = stub_model(MockableModel)
second = stub_model(MockableModel)
second.id.should == (first.id + 1)
Expand All @@ -79,17 +79,17 @@
@real.mockable_model = @stub_model
end

it "should pass associated_model == mock" do
it "passes associated_model == mock" do
@stub_model.should == @real.mockable_model
end

it "should pass mock == associated_model" do
it "passes mock == associated_model" do
@real.mockable_model.should == @stub_model
end
end

describe "with a block" do
it "should yield the model" do
it "yields the model" do
model = stub_model(MockableModel) do |block_arg|
@block_arg = block_arg
end
Expand Down

0 comments on commit 72ecc03

Please sign in to comment.