diff --git a/spec/overcommit/hook/commit_msg/capitalized_subject_spec.rb b/spec/overcommit/hook/commit_msg/capitalized_subject_spec.rb index 0775d818..09910ed7 100644 --- a/spec/overcommit/hook/commit_msg/capitalized_subject_spec.rb +++ b/spec/overcommit/hook/commit_msg/capitalized_subject_spec.rb @@ -7,8 +7,8 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message_lines).and_return(commit_msg.split("\n")) - subject.stub(:empty_message?).and_return(commit_msg.empty?) + context.stub(:commit_message_lines).and_return(commit_msg.split("\n")) + context.stub(:empty_message?).and_return(commit_msg.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/commit_msg/empty_message_spec.rb b/spec/overcommit/hook/commit_msg/empty_message_spec.rb index b7a6d79a..5ccfcb23 100644 --- a/spec/overcommit/hook/commit_msg/empty_message_spec.rb +++ b/spec/overcommit/hook/commit_msg/empty_message_spec.rb @@ -6,7 +6,7 @@ subject { described_class.new(config, context) } before do - subject.stub(:empty_message?).and_return(commit_msg.strip.empty?) + context.stub(:empty_message?).and_return(commit_msg.strip.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb b/spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb index c9533c97..49d13c07 100644 --- a/spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb +++ b/spec/overcommit/hook/commit_msg/gerrit_change_id_spec.rb @@ -9,7 +9,7 @@ before do commit_msg_file.write(commit_msg) commit_msg_file.close - subject.stub(:commit_message_file).and_return(commit_msg_file.path) + context.stub(:commit_message_file).and_return(commit_msg_file.path) end context 'when the commit message contains no Change-Id' do diff --git a/spec/overcommit/hook/commit_msg/hard_tabs_spec.rb b/spec/overcommit/hook/commit_msg/hard_tabs_spec.rb index 8da5db09..68900dd1 100644 --- a/spec/overcommit/hook/commit_msg/hard_tabs_spec.rb +++ b/spec/overcommit/hook/commit_msg/hard_tabs_spec.rb @@ -6,8 +6,8 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message).and_return(commit_msg) - subject.stub(:empty_message?).and_return(commit_msg.empty?) + context.stub(:commit_message).and_return(commit_msg) + context.stub(:empty_message?).and_return(commit_msg.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/commit_msg/russian_novel_spec.rb b/spec/overcommit/hook/commit_msg/russian_novel_spec.rb index eaa748f7..599a34a3 100644 --- a/spec/overcommit/hook/commit_msg/russian_novel_spec.rb +++ b/spec/overcommit/hook/commit_msg/russian_novel_spec.rb @@ -6,7 +6,7 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message_lines).and_return(commit_msg) + context.stub(:commit_message_lines).and_return(commit_msg) end context 'when message contains fewer than 30 lines' do diff --git a/spec/overcommit/hook/commit_msg/single_line_subject_spec.rb b/spec/overcommit/hook/commit_msg/single_line_subject_spec.rb index be09f777..2d4c5ef5 100644 --- a/spec/overcommit/hook/commit_msg/single_line_subject_spec.rb +++ b/spec/overcommit/hook/commit_msg/single_line_subject_spec.rb @@ -6,8 +6,8 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message_lines).and_return(commit_msg.split("\n")) - subject.stub(:empty_message?).and_return(commit_msg.empty?) + context.stub(:commit_message_lines).and_return(commit_msg.split("\n")) + context.stub(:empty_message?).and_return(commit_msg.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/commit_msg/text_width_spec.rb b/spec/overcommit/hook/commit_msg/text_width_spec.rb index 8ec9f97c..f779e91e 100644 --- a/spec/overcommit/hook/commit_msg/text_width_spec.rb +++ b/spec/overcommit/hook/commit_msg/text_width_spec.rb @@ -6,8 +6,8 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message_lines).and_return(commit_msg.split("\n")) - subject.stub(:empty_message?).and_return(commit_msg.empty?) + context.stub(:commit_message_lines).and_return(commit_msg.split("\n")) + context.stub(:empty_message?).and_return(commit_msg.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/commit_msg/trailing_period_spec.rb b/spec/overcommit/hook/commit_msg/trailing_period_spec.rb index 5d86248d..ea5f91c6 100644 --- a/spec/overcommit/hook/commit_msg/trailing_period_spec.rb +++ b/spec/overcommit/hook/commit_msg/trailing_period_spec.rb @@ -6,8 +6,8 @@ subject { described_class.new(config, context) } before do - subject.stub(:commit_message_lines).and_return(commit_msg.split("\n")) - subject.stub(:empty_message?).and_return(commit_msg.empty?) + context.stub(:commit_message_lines).and_return(commit_msg.split("\n")) + context.stub(:empty_message?).and_return(commit_msg.empty?) end context 'when commit message is empty' do diff --git a/spec/overcommit/hook/post_commit/git_guilt_spec.rb b/spec/overcommit/hook/post_commit/git_guilt_spec.rb index 07a578b7..28c8c9f6 100644 --- a/spec/overcommit/hook/post_commit/git_guilt_spec.rb +++ b/spec/overcommit/hook/post_commit/git_guilt_spec.rb @@ -42,7 +42,7 @@ context 'when there is no previous commit' do before do - subject.stub(:initial_commit?).and_return(true) + context.stub(:initial_commit?).and_return(true) end it { should pass } diff --git a/spec/overcommit/hook/pre_push/protected_branches_spec.rb b/spec/overcommit/hook/pre_push/protected_branches_spec.rb index 43df022c..04653eaf 100644 --- a/spec/overcommit/hook/pre_push/protected_branches_spec.rb +++ b/spec/overcommit/hook/pre_push/protected_branches_spec.rb @@ -11,7 +11,7 @@ before do subject.stub(:branches).and_return([protected_branch]) - subject.stub(:pushed_refs).and_return([pushed_ref]) + context.stub(:pushed_refs).and_return([pushed_ref]) end context 'when pushing to unprotected branch' do diff --git a/spec/overcommit/hook/pre_rebase/merged_commits_spec.rb b/spec/overcommit/hook/pre_rebase/merged_commits_spec.rb index 4873effa..72cdaff2 100644 --- a/spec/overcommit/hook/pre_rebase/merged_commits_spec.rb +++ b/spec/overcommit/hook/pre_rebase/merged_commits_spec.rb @@ -13,7 +13,7 @@ context 'when rebasing a detached HEAD' do before do - subject.stub(:detached_head?) { true } + context.stub(:detached_head?) { true } end it { should pass } @@ -21,8 +21,8 @@ context 'when there are no commits to rebase' do before do - subject.stub(:detached_head?) { false } - subject.stub(:rebased_commits) { [] } + context.stub(:detached_head?) { false } + context.stub(:rebased_commits) { [] } end it { should pass } @@ -33,8 +33,8 @@ let(:rebased_branch) { 'topic' } before do - subject.stub(:detached_head?) { false } - subject.stub(:rebased_commits) { [commit_sha1] } + context.stub(:detached_head?) { false } + context.stub(:rebased_commits) { [commit_sha1] } end context 'when commits have not yet been merged' do