Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/test/helpers/fixtures.rb b/test/helpers/fixtures.rb
- index f8b9254..54e9850 100644
- --- a/test/helpers/fixtures.rb
- +++ b/test/helpers/fixtures.rb
- @@ -58,6 +58,15 @@ Integrity::Project.fixture(:my_test_project) do
- :building => false }
- end
- +Integrity::Commit.fixture do
- + {
- + :identifier => Digest::SHA1.hexdigest(/[:paragraph:]/.gen),
- + :message => /[:paragraph:]/,
- + :author => /\w+ \w+/,
- + :committed_at => unique {|i| Time.mktime(2009, 12, 15, 18, (59 - i) % 60) }
- + }
- +end
- +
- Integrity::Build.fixture do
- { :output => /[:paragraph:]/.gen,
- :successful => true,
- diff --git a/test/unit/build_test.rb b/test/unit/build_test.rb
- index b98c120..1b6db24 100644
- --- a/test/unit/build_test.rb
- +++ b/test/unit/build_test.rb
- @@ -42,31 +42,5 @@ class BuildTest < Test::Unit::TestCase
- Build.gen(:successful => true).human_readable_status.should == "Build Successful"
- Build.gen(:successful => false).human_readable_status.should == "Build Failed"
- end
- -
- - it "has a commit identifier" do
- - @build.commit_identifier.should be("658ba96cb0235e82ee720510c049883955200fa9")
- - end
- -
- - it "has a short commit identifier" do
- - @build.short_commit_identifier.should == "658ba96"
- - Build.gen(:commit_identifier => "402").short_commit_identifier.should == "402"
- - end
- -
- - it "has a commit author" do
- - build = Build.gen(:commit_metadata => { :author => "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>" })
- - build.commit_author.name.should == "Nicolás Sanguinetti"
- - build.commit_author.email.should == "contacto@nicolassanguinetti.info"
- - build.commit_author.full.should == "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>"
- - end
- -
- - it "has a commit message" do
- - build = Build.gen(:commit_metadata => { :message => "This commit rocks" })
- - build.commit_message.should == "This commit rocks"
- - end
- -
- - it "has a commit date" do
- - build = Build.gen(:commit_metadata => { :date => Time.utc(2008, 10, 12, 14, 18, 20) })
- - build.commited_at.to_s.should == "Sun Oct 12 14:18:20 UTC 2008"
- - end
- end
- end
- diff --git a/test/unit/commit_test.rb b/test/unit/commit_test.rb
- new file mode 100644
- index 0000000..9198061
- --- /dev/null
- +++ b/test/unit/commit_test.rb
- @@ -0,0 +1,50 @@
- +require File.dirname(__FILE__) + '/../helpers'
- +
- +class CommitTest < Test::Unit::TestCase
- + before(:each) do
- + RR.reset
- + setup_and_reset_database!
- + end
- +
- + specify "fixture is valid and can be saved" do
- + lambda do
- + Commit.generate.tap do |commit|
- + commit.should be_valid
- + commit.save
- + end
- + end.should change(Commit, :count).by(1)
- + end
- +
- + describe "Properties" do
- + before(:each) do
- + @commit = Commit.generate(:identifier => "658ba96cb0235e82ee720510c049883955200fa9")
- + end
- +
- + it "has a commit identifier" do
- + @commit.identifier.should be("658ba96cb0235e82ee720510c049883955200fa9")
- + end
- +
- + it "has a short commit identifier" do
- + @commit.short_commit_identifier.should == "658ba96"
- +# Build.gen(:commit_identifier => "402").short_commit_identifier.should == "402"
- + end
- +
- +# it "has a commit author" do
- +# pending
- +# commit = Commit.gen(:author => "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>")
- +# commit.author.name.should == "Nicolás Sanguinetti"
- +# commit.author.email.should == "contacto@nicolassanguinetti.info"
- +# commit.author.full.should == "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>"
- +# end
- +
- + it "has a commit message" do
- + commit = Commit.gen(:message => "This commit rocks")
- + commit.message.should == "This commit rocks"
- + end
- +
- + it "has a commit date" do
- + commit = Commit.gen(:committed_at => Time.utc(2008, 10, 12, 14, 18, 20))
- + commit.committed_at.to_s.should == "2008-10-12T14:18:20+00:00"
- + end
- + end
- +end
Add Comment
Please, Sign In to add comment