summaryrefslogtreecommitdiff
path: root/spec/models/commit_spec.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-12 16:47:52 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-02-12 16:47:52 -0800
commit529188e4788991961796b1b6131389072ee61efb (patch)
treec4c12a7b2cb287fbc4065c886e53740e1ec41ae5 /spec/models/commit_spec.rb
parent2ff1b8e68d085a8b43507630b3986743d2a48145 (diff)
parent1343b2dfac288eb60d536cc3d1a94de1eb178b51 (diff)
downloadgitlab-ce-529188e4788991961796b1b6131389072ee61efb.tar.gz
Merge branch 'master' of github.com:gitlabhq/gitlabhq
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index 7a2a7a4ce9b..8b3d88640da 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -6,22 +6,22 @@ describe Commit do
describe '#title' do
it "returns no_commit_message when safe_message is blank" do
- commit.stub(:safe_message).and_return('')
- commit.title.should == "--no commit message"
+ allow(commit).to receive(:safe_message).and_return('')
+ expect(commit.title).to eq("--no commit message")
end
it "truncates a message without a newline at 80 characters" do
message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis id blandit. Vivamus egestas lacinia lacus, sed rutrum mauris.'
- commit.stub(:safe_message).and_return(message)
- commit.title.should == "#{message[0..79]}&hellip;"
+ allow(commit).to receive(:safe_message).and_return(message)
+ expect(commit.title).to eq("#{message[0..79]}&hellip;")
end
it "truncates a message with a newline before 80 characters at the newline" do
message = commit.safe_message.split(" ").first
- commit.stub(:safe_message).and_return(message + "\n" + message)
- commit.title.should == message
+ allow(commit).to receive(:safe_message).and_return(message + "\n" + message)
+ expect(commit.title).to eq(message)
end
it "does not truncates a message with a newline after 80 but less 100 characters" do
@@ -30,25 +30,25 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales id felis
Vivamus egestas lacinia lacus, sed rutrum mauris.
eos
- commit.stub(:safe_message).and_return(message)
- commit.title.should == message.split("\n").first
+ allow(commit).to receive(:safe_message).and_return(message)
+ expect(commit.title).to eq(message.split("\n").first)
end
end
describe "delegation" do
subject { commit }
- it { should respond_to(:message) }
- it { should respond_to(:authored_date) }
- it { should respond_to(:committed_date) }
- it { should respond_to(:committer_email) }
- it { should respond_to(:author_email) }
- it { should respond_to(:parents) }
- it { should respond_to(:date) }
- it { should respond_to(:diffs) }
- it { should respond_to(:tree) }
- it { should respond_to(:id) }
- it { should respond_to(:to_patch) }
+ it { is_expected.to respond_to(:message) }
+ it { is_expected.to respond_to(:authored_date) }
+ it { is_expected.to respond_to(:committed_date) }
+ it { is_expected.to respond_to(:committer_email) }
+ it { is_expected.to respond_to(:author_email) }
+ it { is_expected.to respond_to(:parents) }
+ it { is_expected.to respond_to(:date) }
+ it { is_expected.to respond_to(:diffs) }
+ it { is_expected.to respond_to(:tree) }
+ it { is_expected.to respond_to(:id) }
+ it { is_expected.to respond_to(:to_patch) }
end
describe '#closes_issues' do
@@ -58,13 +58,13 @@ eos
it 'detects issues that this commit is marked as closing' do
commit.stub(safe_message: "Fixes ##{issue.iid}")
- commit.closes_issues(project).should == [issue]
+ expect(commit.closes_issues(project)).to eq([issue])
end
it 'does not detect issues from other projects' do
ext_ref = "#{other_project.path_with_namespace}##{other_issue.iid}"
commit.stub(safe_message: "Fixes #{ext_ref}")
- commit.closes_issues(project).should be_empty
+ expect(commit.closes_issues(project)).to be_empty
end
end