Permalink
Browse files

Clarify the language of spec messages

  • Loading branch information...
1 parent 36b85ea commit 01b910fdc6178d746bda2695b11642adaeec6601 @njonsson committed Feb 17, 2012
@@ -7,10 +7,8 @@
end
describe 'with specified attributes' do
- subject {
- described_class.new :rake => 'I see you have the machine that goes "Bing!"'
- }
+ subject { described_class.new :rake => 'the specified value of #rake' }
- its(:rake) { should == 'I see you have the machine that goes "Bing!"' }
+ its(:rake) { should == 'the specified value of #rake' }
end
end
@@ -1,12 +1,12 @@
require 'cape/core_ext/hash'
describe Hash do
- describe '#slice' do
- it 'should return the expected Hash' do
- hash = {:foo => 'bar', :baz => 'qux', :quux => 'corge'}
- hash.slice(:baz, :quux).should == {:baz => 'qux', :quux => 'corge'}
+ subject { {:foo => 'bar', :baz => 'qux', :quux => 'corge'} }
- {}.slice(:foo).should == {}
+ describe '-- when sent #slice with keys that are present and those that are not --' do
+ it 'should return the expected subset hash' do
+ subject.slice(:baz, :fizzle, :quux).should == {:baz => 'qux',
+ :quux => 'corge'}
end
end
end
@@ -1,7 +1,15 @@
require 'cape/core_ext/symbol'
describe Symbol do
- it 'should compare as expected to another Symbol' do
+ it '-- when sent #<=> with a lower symbol -- should return 1' do
(:foo <=> :bar).should == 1
end
+
+ it '-- when sent #<=> with a higher symbol -- should return -1' do
+ (:baz <=> :qux).should == -1
+ end
+
+ it '-- when sent #<=> with itself -- should return 0' do
+ (:quux <=> :quux).should == 0
+ end
end
View
@@ -3,6 +3,7 @@
require 'cape/core_ext/hash'
require 'cape/core_ext/symbol'
require 'cape/rake'
+require ::File.expand_path('../../spec_helper', __FILE__)
describe Cape::DSL do
subject do
@@ -22,7 +23,7 @@
Cape::Rake. stub!(:new).and_return mock_rake
end
- describe 'when sent #each_rake_task' do
+ describe '-- when sent #each_rake_task --' do
def do_each_rake_task(&block)
subject.each_rake_task(task_expression, &block)
end
@@ -41,7 +42,7 @@ def do_each_rake_task(&block)
end
end
- describe 'when sent #mirror_rake_tasks' do
+ describe '-- when sent #mirror_rake_tasks' do
before :each do
mock_rake.stub!(:each_task).and_yield({:name => task_expression})
subject.stub! :raise_unless_capistrano
@@ -51,7 +52,7 @@ def do_mirror_rake_tasks(*arguments, &block)
subject.mirror_rake_tasks(*arguments, &block)
end
- describe 'with two scalar arguments' do
+ describe 'with two scalar arguments --' do
specify do
lambda {
do_mirror_rake_tasks task_expression, task_expression
@@ -63,17 +64,17 @@ def do_mirror_rake_tasks(*arguments, &block)
shared_examples_for 'a successful call' do |task_expression_in_use,
options_in_use|
- it 'should collect Rake#each_task' do
+ specify 'by collecting Rake#each_task' do
mock_rake.should_receive(:each_task).with task_expression_in_use
do_mirror_rake_tasks
end
- it 'should verify that Capistrano is in use' do
+ specify 'by verifying that Capistrano is in use' do
subject.should_receive :raise_unless_capistrano
do_mirror_rake_tasks
end
- describe 'should Capistrano#define_rake_wrapper for Rake#each_task' do
+ describe 'by sending Capistrano#define_rake_wrapper for Rake#each_task' do
specify 'with the expected task' do
mock_capistrano.should_receive(:define_rake_wrapper).with do |task,
named_arguments|
@@ -107,75 +108,75 @@ def do_mirror_rake_tasks(*arguments, &block)
end
end
- it 'should return itself' do
+ specify 'by returning itself' do
do_mirror_rake_tasks.should == subject
end
end
- describe 'with one scalar argument, an options hash, and a block' do
+ describe 'with one scalar argument, an options hash, and a block --' do
def do_mirror_rake_tasks
super 'task:expression', :bar => :baz do |env|
env['AN_ENV_VAR'] = 'an environment variable'
end
end
- it_should_behave_like 'a successful call', 'task:expression', :bar => :baz
+ should_behave_like 'a successful call', 'task:expression', :bar => :baz
end
- describe 'with one scalar argument and an options hash' do
+ describe 'with one scalar argument and an options hash --' do
def do_mirror_rake_tasks
super 'task:expression', :bar => :baz
end
- it_should_behave_like 'a successful call', 'task:expression', :bar => :baz
+ should_behave_like 'a successful call', 'task:expression', :bar => :baz
end
- describe 'with an options hash and a block' do
+ describe 'with an options hash and a block --' do
def do_mirror_rake_tasks
super :bar => :baz do |env|
env['AN_ENV_VAR'] = 'an environment variable'
end
end
- it_should_behave_like 'a successful call', nil, :bar => :baz
+ should_behave_like 'a successful call', nil, :bar => :baz
end
- describe 'with an options hash' do
+ describe 'with an options hash --' do
def do_mirror_rake_tasks
super :bar => :baz
end
- it_should_behave_like 'a successful call', nil, :bar => :baz
+ should_behave_like 'a successful call', nil, :bar => :baz
end
- describe 'with one scalar argument and a block' do
+ describe 'with one scalar argument and a block --' do
def do_mirror_rake_tasks
super 'task:expression' do |env|
env['AN_ENV_VAR'] = 'an environment variable'
end
end
- it_should_behave_like('a successful call', 'task:expression', {})
+ should_behave_like('a successful call', 'task:expression', {})
end
- describe 'with one scalar argument' do
+ describe 'with one scalar argument --' do
def do_mirror_rake_tasks
super 'task:expression'
end
- it_should_behave_like('a successful call', 'task:expression', {})
+ should_behave_like('a successful call', 'task:expression', {})
end
- describe 'without arguments' do
+ describe 'without arguments --' do
def do_mirror_rake_tasks
super
end
- it_should_behave_like('a successful call', nil, {})
+ should_behave_like('a successful call', nil, {})
end
end
- describe 'when sent #local_rake_executable' do
+ describe '-- when sent #local_rake_executable --' do
before :each do
mock_rake.stub!(:local_executable).and_return 'foo'
end
@@ -190,7 +191,7 @@ def do_mirror_rake_tasks
end
end
- describe 'when sent #remote_rake_executable' do
+ describe '-- when sent #remote_rake_executable --' do
before :each do
mock_rake.stub!(:remote_executable).and_return 'foo'
end
View
@@ -9,7 +9,7 @@
it { should be_frozen }
end
- describe '#==' do
+ describe '-- when sent #== --' do
it('should recognize equivalent instances to be equal') {
described_class.new.should == described_class.new
}
@@ -23,22 +23,28 @@
}
end
- describe 'without specified attributes' do
+ describe '-- without specified attributes --' do
its(:local_executable) { should == '/usr/bin/env rake' }
its(:remote_executable) { should == '/usr/bin/env rake' }
end
- describe 'with specified attributes' do
- subject { described_class.new :local_executable => 'And now for something',
- :remote_executable => 'completely different' }
+ describe '-- with specified attributes --' do
+ subject {
+ described_class.new :local_executable => 'the specified value of #local_executable',
+ :remote_executable => 'the specified value of #remote_executable'
+ }
- its(:local_executable) { should == 'And now for something' }
+ its(:local_executable) {
+ should == 'the specified value of #local_executable'
+ }
- its(:remote_executable) { should == 'completely different' }
+ its(:remote_executable) {
+ should == 'the specified value of #remote_executable'
+ }
end
- describe 'caching: ' do
+ describe '-- with respect to caching --' do
before :each do
subject.stub!(:fetch_output).and_return output
end
@@ -51,7 +57,7 @@
end_output
}
- describe '#each_task' do
+ describe 'when sent #each_task,' do
it 'should build and use a cache' do
subject.should_receive(:fetch_output).once.and_return output
subject.each_task do |t|
@@ -85,7 +91,7 @@
end
end
- describe '#expire_cache!' do
+ describe 'when sent #expire_cache!,' do
it 'should expire the cache' do
subject.should_receive(:fetch_output).twice.and_return output
subject.each_task do |t|
@@ -96,15 +102,15 @@
end
end
- describe '#local_executable=' do
- describe 'with the same value' do
+ describe 'when sent #local_executable=' do
+ describe 'with the same value,' do
it 'should not expire the cache' do
subject.should_not_receive :expire_cache!
subject.local_executable = subject.local_executable
end
end
- describe 'with a different value' do
+ describe 'with a different value,' do
it 'should expire the cache' do
subject.should_receive(:expire_cache!).once
subject.local_executable = subject.local_executable + ' foo'
View
@@ -10,7 +10,7 @@
Cape::Util.pluralize('foo', 2).should == 'foos'
end
- it "should not pluralize for a count of 1" do
+ it "should not pluralize 'foo' for a count of 1" do
Cape::Util.pluralize('foo', 1).should == 'foo'
end
@@ -1,5 +1,5 @@
require 'cape/version'
-describe Cape::VERSION do
- it { should =~ /^\d+\.\d+\.\d+/ }
+describe 'Cape::VERSION' do
+ specify { Cape::VERSION.should =~ /^\d+\.\d+\.\d+/ }
end
View
@@ -0,0 +1,4 @@
+RSpec.configure do |c|
+ c.alias_it_should_behave_like_to :should_behave_like,
+ 'should behave like'
+end

0 comments on commit 01b910f

Please sign in to comment.