Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-03 21:11:14 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-03 21:11:14 +0400
commite6c0673ef1108a93928c4d88ba273e12616b836b (patch)
tree421050c37fa8bcdecf94781473380c54bcecdda6 /spec/models/commit_spec.rb
parent2095780f24db7c75f5a004654ae2e4052fe16bdd (diff)
Rspec models Milestone, Commit, UsersProject
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb61
1 files changed, 61 insertions, 0 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index e4bc1936839..e760c501bd7 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -34,4 +34,65 @@ describe Commit do
end
end
end
+
+ describe "Commit info" do
+ before do
+ @committer = double(
+ email: 'mike@smith.com',
+ name: 'Mike Smith'
+ )
+
+ @author = double(
+ email: 'john@smith.com',
+ name: 'John Smith'
+ )
+
+ @raw_commit = double(
+ id: "bcf03b5de6abcf03b5de6c",
+ author: @author,
+ committer: @committer,
+ committed_date: Date.yesterday,
+ message: 'Refactoring specs'
+ )
+
+ @commit = Commit.new(@raw_commit)
+ end
+
+ it { @commit.short_id.should == "bcf03b5de6a" }
+ it { @commit.safe_message.should == @raw_commit.message }
+ it { @commit.created_at.should == @raw_commit.committed_date }
+ it { @commit.author_email.should == @author.email }
+ it { @commit.author_name.should == @author.name }
+ it { @commit.committer_name.should == @committer.name }
+ it { @commit.committer_email.should == @committer.email }
+ it { @commit.different_committer?.should be_true }
+ end
+
+ describe "Class methods" do
+ subject { Commit }
+
+ it { should respond_to(:find_or_first) }
+ it { should respond_to(:fresh_commits) }
+ it { should respond_to(:commits_with_refs) }
+ it { should respond_to(:commits_since) }
+ it { should respond_to(:commits_between) }
+ it { should respond_to(:commits) }
+ it { should respond_to(:compare) }
+ 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(:parents) }
+ it { should respond_to(:date) }
+ it { should respond_to(:committer) }
+ it { should respond_to(:author) }
+ it { should respond_to(:diffs) }
+ it { should respond_to(:tree) }
+ it { should respond_to(:id) }
+ it { should respond_to(:to_patch) }
+ end
end