Permalink
Browse files

Use newer Rspec-mocks spies.

  • Loading branch information...
1 parent e267a5e commit 510aa20eb73d5fcbcf4b1f9b2216adee2bb52676 @stevenharman committed Aug 12, 2013
Showing with 9 additions and 11 deletions.
  1. +0 −1 .rspec
  2. +1 −2 git_tracker.gemspec
  3. +8 −8 spec/git_tracker/prepare_commit_message_spec.rb
View
1 .rspec
@@ -1,4 +1,3 @@
--colour
-I spec/support
--r rspec-spies
-r pry
View
@@ -13,8 +13,7 @@ Gem::Specification.new do |gem|
better... and easier... um, besier!
EOF
- gem.add_development_dependency "rspec", "~> 2.12"
- gem.add_development_dependency "rspec-spies", "~> 2.0"
+ gem.add_development_dependency "rspec", "~> 2.14"
gem.add_development_dependency "activesupport", "~> 3.2"
gem.add_development_dependency "pry", "~> 0.9.11"
gem.add_development_dependency "rake"
@@ -37,8 +37,11 @@
describe '#run' do
let(:hook) { GitTracker::PrepareCommitMessage.new('FILE1') }
+ let(:commit_message) { double('CommitMessage', append: nil) }
+
before do
GitTracker::Branch.stub(:story_number) { story }
+ GitTracker::CommitMessage.stub(:new) { commit_message }
end
context 'with an existing commit (via `-c`, `-C`, or `--amend` options)' do
@@ -54,33 +57,30 @@
it 'exits without updating the commit message' do
expect { hook.run }.to succeed
- GitTracker::CommitMessage.should_not have_received(:append)
+ expect(commit_message).to_not have_received(:append)
end
end
context 'branch name with a Pivotal Tracker story number' do
let(:story) { '8675309' }
- let(:commit_message) { double('CommitMessage', :mentions_story? => false) }
-
before do
+ commit_message.stub(:mentions_story?) { false }
commit_message.stub(:keyword) { nil }
- GitTracker::CommitMessage.stub(:new) { commit_message }
end
it 'appends the number to the commit message' do
- commit_message.should_receive(:append).with('[#8675309]')
hook.run
+ expect(commit_message).to have_received(:append).with('[#8675309]')
end
context 'keyword mentioned in the commit message' do
before do
- commit_message.stub(:mentions_story?).with('8675309') { false }
commit_message.stub(:keyword) { 'Delivers' }
end
it 'appends the keyword and the story number' do
- commit_message.should_receive(:append).with('[Delivers #8675309]')
hook.run
+ expect(commit_message).to have_received(:append).with('[Delivers #8675309]')
end
end
@@ -91,7 +91,7 @@
it 'exits without updating the commit message' do
expect { hook.run }.to succeed
- GitTracker::CommitMessage.should_not have_received(:append)
+ expect(commit_message).to_not have_received(:append)
end
end
end

0 comments on commit 510aa20

Please sign in to comment.