alphasights-integrity 0.1.9.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/.gitignore +0 -1
  2. data/AUTHORS +35 -0
  3. data/CHANGES +21 -3
  4. data/LICENSE +20 -0
  5. data/README.md +10 -52
  6. data/config/config.sample.yml +4 -0
  7. data/config/heroku/.gems +1 -1
  8. data/config/heroku/integrity-config.rb +1 -0
  9. data/integrity.gemspec +6 -11
  10. data/lib/integrity.rb +4 -4
  11. data/lib/integrity/app.rb +1 -1
  12. data/lib/integrity/build.rb +8 -18
  13. data/lib/integrity/commit.rb +13 -8
  14. data/lib/integrity/helpers/pretty_output.rb +8 -0
  15. data/lib/integrity/helpers/urls.rb +3 -3
  16. data/lib/integrity/installer.rb +20 -11
  17. data/lib/integrity/migrations.rb +43 -13
  18. data/lib/integrity/notifier.rb +1 -1
  19. data/lib/integrity/notifier/base.rb +2 -2
  20. data/lib/integrity/notifier/test/fixtures.rb +12 -6
  21. data/lib/integrity/project.rb +34 -38
  22. data/lib/integrity/project/push.rb +4 -5
  23. data/test/acceptance/api_test.rb +1 -1
  24. data/test/acceptance/browse_project_test.rb +12 -6
  25. data/test/acceptance/build_notifications_test.rb +26 -2
  26. data/test/acceptance/installer_test.rb +1 -1
  27. data/test/acceptance/manual_build_project_test.rb +2 -2
  28. data/test/acceptance/notifier_test_test.rb +37 -0
  29. data/test/acceptance/stylesheet_test.rb +2 -1
  30. data/test/helpers.rb +3 -2
  31. data/test/unit/build_test.rb +11 -46
  32. data/test/unit/commit_test.rb +37 -28
  33. data/test/unit/helpers_test.rb +16 -0
  34. data/test/unit/migrations_test.rb +6 -4
  35. data/test/unit/project_test.rb +64 -95
  36. data/views/_commit_info.haml +6 -10
  37. data/views/home.haml +3 -2
  38. data/views/integrity.sass +24 -4
  39. data/views/project.haml +5 -4
  40. metadata +6 -20
  41. data/lib/integrity/helpers/gravatar.rb +0 -16
  42. data/lib/integrity/project_builder.rb +0 -56
  43. data/lib/integrity/scm.rb +0 -19
  44. data/lib/integrity/scm/git.rb +0 -84
  45. data/lib/integrity/scm/git/uri.rb +0 -57
  46. data/test/unit/project_builder_test.rb +0 -118
  47. data/test/unit/scm_test.rb +0 -54
@@ -40,7 +40,7 @@ class ManualBuildProjectTest < Test::Unit::AcceptanceTestCase
40
40
  git_repo(:my_test_project).add_successful_commit
41
41
  Project.gen(:my_test_project,
42
42
  :uri => git_repo(:my_test_project).path,
43
- :command => "ruby not-found.rb")
43
+ :command => "echo FAIL && exit 1")
44
44
 
45
45
  login_as "admin", "test"
46
46
 
@@ -53,7 +53,7 @@ class ManualBuildProjectTest < Test::Unit::AcceptanceTestCase
53
53
  click_button "Update Project"
54
54
 
55
55
  visit "/my-test-project"
56
- click_button "Build the last commit"
56
+ click_button "Fetch and build"
57
57
 
58
58
  assert_have_tag("h1", :content => "success")
59
59
  end
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + "/../helpers/acceptance"
2
+ require "helpers/acceptance/email_notifier"
3
+ require "helpers/acceptance/textfile_notifier"
4
+
5
+ require "integrity/notifier/test"
6
+
7
+ class NotifierTestTest < Test::Unit::TestCase
8
+ include Integrity::Notifier::Test
9
+
10
+ setup do
11
+ @notifier = Integrity::Notifier::Textfile
12
+ @config = {"file" => "/tmp/integrity.txt"}
13
+
14
+ FileUtils.rm @config["file"] if File.exists?(@config["file"])
15
+ end
16
+
17
+ def notifier
18
+ "Textfile"
19
+ end
20
+
21
+ test "it provides a formulary to configure options" do
22
+ assert provides_option?("file")
23
+ assert provides_option?("file", @config["file"])
24
+ end
25
+
26
+ test "it sends notification" do
27
+ build = build(:successful)
28
+
29
+ @notifier.notify_of_build(build, @config)
30
+
31
+ notification = File.read(@config["file"])
32
+
33
+ assert notification.start_with?("===")
34
+ assert notification.include?(build.commit.identifier)
35
+ assert notification.include?("successful")
36
+ end
37
+ end
@@ -10,11 +10,12 @@ class IntegrityStylesheetTest < Test::Unit::AcceptanceTestCase
10
10
  scenario "browsing on some Integrity install" do
11
11
  visit "/"
12
12
  assert_have_tag("link[@href='/integrity.css']")
13
+
13
14
  visit "/integrity.css"
14
15
 
15
16
  assert_contain("body {")
16
17
  # TODO: Check that it actually returns a 302
17
- assert_equal %Q{"2465c472aacf302259dde5146a841e45"},
18
+ assert_equal %Q{"de9cf45fa61c8a2bb96c17fc16998599"},
18
19
  webrat_session.send(:response).headers["ETag"]
19
20
 
20
21
  visit "/reset.css"
data/test/helpers.rb CHANGED
@@ -4,7 +4,6 @@ require "rubygems"
4
4
 
5
5
  require "test/unit"
6
6
  require "rr"
7
- require "mocha"
8
7
  require "dm-sweatshop"
9
8
  require "webrat/sinatra"
10
9
 
@@ -29,6 +28,7 @@ end
29
28
  module TestHelper
30
29
  def ignore_logs!
31
30
  Integrity.config[:log] = "/tmp/integrity.test.log"
31
+ Bob.logger = Logger.new("/dev/null")
32
32
  end
33
33
 
34
34
  def capture_stdout
@@ -58,8 +58,9 @@ class Test::Unit::TestCase
58
58
 
59
59
  before(:all) do
60
60
  DataMapper.setup(:default, "sqlite3::memory:")
61
-
62
61
  require "integrity/migrations"
62
+
63
+ ignore_logs!
63
64
  end
64
65
 
65
66
  before(:each) do
@@ -1,11 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../helpers'
2
2
 
3
3
  class BuildTest < Test::Unit::TestCase
4
- before(:each) do
5
- RR.reset
6
- end
7
-
8
- specify "fixture is valid and can be saved" do
4
+ test "fixture is valid and can be saved" do
9
5
  lambda do
10
6
  build = Build.gen
11
7
  build.save
@@ -15,58 +11,27 @@ class BuildTest < Test::Unit::TestCase
15
11
  end
16
12
 
17
13
  describe "Properties" do
18
- before(:each) do
19
- @build = Build.gen
20
- end
21
-
22
14
  it "captures the build's STDOUT/STDERR" do
23
- @build.output.should_not be_blank
15
+ assert ! Build.gen.output.empty?
24
16
  end
25
17
 
26
18
  it "knows if it failed or not" do
27
- @build.successful = true
28
- @build.should be_successful
29
- @build.successful = false
30
- @build.should be_failed
19
+ assert Build.gen(:successful => true).successful?
20
+ assert ! Build.gen(:successful => false).successful?
31
21
  end
32
22
 
33
23
  it "knows it's status" do
34
- @build.successful = true
35
- @build.status.should be(:success)
36
- @build.successful = false
37
- @build.status.should be(:failed)
38
- end
39
- end
24
+ assert_equal :success, Build.gen(:successful => true).status
25
+ assert_equal :failed, Build.gen(:successful => false).status
40
26
 
41
- describe "Pending builds" do
42
- before(:each) do
43
- 3.of { Build.gen(:started_at => nil) }
44
- 2.of { Build.gen(:started_at => Time.mktime(2009, 1, 17, 23, 18)) }
45
- end
46
-
47
- it "finds builds that need to be built" do
48
- Build.should have(3).pending
27
+ assert_equal :pending, Build.gen(:started_at => nil).status
49
28
  end
50
29
  end
51
30
 
52
- describe "Queueing a build" do
53
- before(:each) do
54
- @commit = Commit.gen
55
- stub.instance_of(ProjectBuilder).build(@commit)
56
- end
57
-
58
- it "creates an empty Build" do
59
- @commit.build.should be_nil
60
- Build.queue(@commit)
61
- @commit.build.should_not be_nil
62
- end
63
-
64
- it "ensures the build is saved" do
65
- @commit.build.should be_nil
66
- Build.queue(@commit)
31
+ it "finds pending builds" do
32
+ 3.of { Build.gen(:started_at => nil) }
33
+ 2.of { Build.gen(:started_at => Time.mktime(2009, 1, 17, 23, 18)) }
67
34
 
68
- commit = Commit.first(:identifier => @commit.identifier)
69
- commit.build.should_not be_nil
70
- end
35
+ Build.should have(3).pending
71
36
  end
72
37
  end
@@ -1,7 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../helpers'
2
2
 
3
3
  class CommitTest < Test::Unit::TestCase
4
- specify "fixture is valid and can be saved" do
4
+ test "fixture is valid and can be saved" do
5
5
  lambda do
6
6
  commit = Commit.gen
7
7
  commit.save
@@ -12,57 +12,66 @@ class CommitTest < Test::Unit::TestCase
12
12
 
13
13
  describe "Properties" do
14
14
  before(:each) do
15
- @commit = Commit.generate(:identifier => "658ba96cb0235e82ee720510c049883955200fa9",
16
- :author => "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>")
15
+ @commit = Commit.gen(
16
+ :message => "Initial commit",
17
+ :identifier => "658ba96cb0235e82ee720510c049883955200fa9",
18
+ :author => "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>")
17
19
  end
18
20
 
19
21
  it "has a commit identifier" do
20
- @commit.identifier.should be("658ba96cb0235e82ee720510c049883955200fa9")
22
+ assert_equal "658ba96cb0235e82ee720510c049883955200fa9",
23
+ @commit.identifier
21
24
  end
22
25
 
23
26
  it "has a short commit identifier" do
24
- @commit.short_identifier.should == "658ba96"
27
+ assert_equal "658ba96", @commit.short_identifier
25
28
 
26
29
  @commit.identifier = "402"
27
- @commit.short_identifier.should == "402"
30
+ assert_equal "402", @commit.short_identifier
28
31
  end
29
32
 
30
33
  it "has a commit author" do
31
- commit = Commit.gen(:author => "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>")
32
- commit.author.name.should == "Nicolás Sanguinetti"
33
- commit.author.email.should == "contacto@nicolassanguinetti.info"
34
- commit.author.full.should == "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>"
34
+ assert_equal "Nicolás Sanguinetti", @commit.author.name
35
+ assert_equal "contacto@nicolassanguinetti.info", @commit.author.email
36
+ assert_equal "Nicolás Sanguinetti <contacto@nicolassanguinetti.info>",
37
+ @commit.author.to_s
35
38
 
36
- Commit.gen(:author => nil).author.to_s.should =~ /not loaded/
37
- end
38
-
39
- it "raises ArgumentError with invalid author" do
40
- lambda { Commit.gen(:author => "foo") }.should raise_error(ArgumentError)
39
+ assert_equal @commit.author.full, @commit.author.to_s
40
+ assert_match /not loaded/, Commit.gen(:author => nil).author.to_s
41
+ assert_raises(ArgumentError) { Commit.gen(:author => "foo") }
41
42
  end
42
43
 
43
44
  it "has a commit message" do
44
- commit = Commit.gen(:message => "This commit rocks")
45
- commit.message.should == "This commit rocks"
46
-
47
- Commit.gen(:message => nil).message.should =~ /not loaded/
45
+ assert_equal "Initial commit", @commit.message
46
+ assert_match /not loaded/, Commit.gen(:message => nil).message
48
47
  end
49
-
48
+
50
49
  it "normalizes the commit date time to the local timezone" do
51
50
  ENV['TZ'] = 'US/Eastern' # -04:00
52
51
  time = Time.parse("2009-04-16T02:24:51-07:00")
53
52
  commit = Commit.gen(:committed_at => time)
54
53
  commit.committed_at.to_s.should == "2009-04-16T05:24:51-04:00"
55
- end
56
-
54
+ end
55
+
57
56
  it "has a human readable status" do
58
- commit = Commit.gen(:successful, :identifier => "658ba96cb0235e82ee720510c049883955200fa9")
59
- commit.human_readable_status.should be("Built 658ba96 successfully")
57
+ assert_match /^Built (.*?) successfully$/,
58
+ Commit.gen(:successful).human_readable_status
59
+
60
+ assert_match /^Built (.*?) and failed$/,
61
+ Commit.gen(:failed).human_readable_status
60
62
 
61
- commit = Commit.gen(:failed, :identifier => "658ba96cb0235e82ee720510c049883955200fa9")
62
- commit.human_readable_status.should be("Built 658ba96 and failed")
63
+ assert_match(/^(.*?) hasn\'t been built yet$/,
64
+ Commit.gen(:pending).human_readable_status)
63
65
 
64
- commit = Commit.gen(:pending, :identifier => "658ba96cb0235e82ee720510c049883955200fa9")
65
- commit.human_readable_status.should be("658ba96 hasn't been built yet")
66
+ assert_match(/^(.*?) is being build$/,
67
+ Commit.gen(:building).human_readable_status)
66
68
  end
67
69
  end
70
+
71
+ it "knows its status" do
72
+ assert Commit.gen(:successful).successful?
73
+ assert Commit.gen(:failed).failed?
74
+ assert Commit.gen(:pending).pending?
75
+ assert Commit.gen(:building).building?
76
+ end
68
77
  end
@@ -23,6 +23,15 @@ class BrowsePublicProjectsTest < Test::Unit::TestCase
23
23
  @h.pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
24
24
  @h.pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
25
25
  end
26
+
27
+ test "#pretty_time" do
28
+ @h.pretty_time(Time.mktime(1995, 12, 01, 02, 04)).should == "02:04"
29
+ end
30
+
31
+ test "#pretty_date_time" do
32
+ datetime = Time.mktime(1995, 12, 01, 02, 04)
33
+ @h.pretty_date_time(datetime).should == "on Dec 01st @ 02:04"
34
+ end
26
35
 
27
36
  describe "urls" do
28
37
  before do
@@ -61,6 +70,13 @@ class BrowsePublicProjectsTest < Test::Unit::TestCase
61
70
  }
62
71
  end
63
72
 
73
+ test "build commit" do
74
+ assert_equal "/ci/foo-bar/commits/#{@commit.identifier}/builds",
75
+ @h.commit_path(@build.commit, :builds)
76
+ assert_equal "http://example.org/ci/foo-bar/commits/#{@commit.identifier}/builds",
77
+ @h.commit_url(@build.commit, :builds).to_s
78
+ end
79
+
64
80
  test "compat" do
65
81
  silence_warnings {
66
82
  assert_equal @h.build_path(@build), @h.commit_path(@build.commit)
@@ -31,18 +31,20 @@ class MigrationsTest < Test::Unit::TestCase
31
31
  test "upgrading a pre migration database" do
32
32
  capture_stdout { Integrity.migrate_db }
33
33
 
34
- current_migrations.should == ["initial", "add_commits", "add_enabled_column", "add_url_to_commits"]
34
+ current_migrations.should == ["initial", "add_commits",
35
+ "add_enabled_column", "nil_commit_metadata", "add_commit_uri_column"]
35
36
  assert table_exists?("integrity_projects")
36
37
  assert table_exists?("integrity_builds")
37
38
  assert table_exists?("integrity_notifiers")
38
39
  assert table_exists?("integrity_commits")
39
40
  end
40
41
 
41
- test "migrating data from initial to add_commits migration" do
42
+ test "migrating data up from initial to the last migration" do
42
43
  load_initial_migration_fixture
43
-
44
44
  capture_stdout { Integrity.migrate_db }
45
- current_migrations.should == ["initial", "add_commits", "add_enabled_column", "add_url_to_commits"]
45
+
46
+ current_migrations.should == ["initial", "add_commits",
47
+ "add_enabled_column", "nil_commit_metadata","add_commit_uri_column"]
46
48
 
47
49
  sinatra = Project.first(:name => "Sinatra")
48
50
  sinatra.should have(1).commits
@@ -1,12 +1,7 @@
1
1
  require File.dirname(__FILE__) + "/../helpers"
2
2
 
3
3
  class ProjectTest < Test::Unit::TestCase
4
- before(:each) do
5
- RR.reset
6
- ignore_logs!
7
- end
8
-
9
- specify "default fixture is valid and can be saved" do
4
+ test "default fixture is valid and can be saved" do
10
5
  lambda do
11
6
  Project.generate.tap do |project|
12
7
  project.should be_valid
@@ -15,7 +10,7 @@ class ProjectTest < Test::Unit::TestCase
15
10
  end.should change(Project, :count).by(1)
16
11
  end
17
12
 
18
- specify "integrity fixture is valid and can be saved" do
13
+ test "integrity fixture is valid and can be saved" do
19
14
  lambda do
20
15
  Project.generate(:integrity).tap do |project|
21
16
  project.should be_valid
@@ -30,85 +25,86 @@ class ProjectTest < Test::Unit::TestCase
30
25
  end
31
26
 
32
27
  it "has a name" do
33
- @project.name.should == "Integrity"
28
+ assert_equal "Integrity", @project.name
34
29
  end
35
30
 
36
31
  it "has a permalink" do
37
- @project.permalink.should == "integrity"
32
+ assert_equal "integrity", @project.permalink
38
33
 
39
- @project.tap do |project|
40
- project.name = "foo's bar/baz and BACON?!"
41
- project.save
42
- end.permalink.should == "foos-bar-baz-and-bacon"
34
+ assert_equal "foos-bar-baz-and-bacon",
35
+ Project.gen(:name => "foo's bar/baz and BACON?!").permalink
43
36
  end
44
37
 
45
38
  it "has an URI" do
46
- @project.uri.should == Addressable::URI.parse("git://github.com/foca/integrity.git")
39
+ assert_equal "git://github.com/foca/integrity.git",
40
+ @project.uri.to_s
47
41
  end
48
42
 
49
43
  it "has a branch" do
50
- @project.branch.should == "master"
51
- end
52
-
53
- specify "branch defaults to master" do
54
- Project.new.branch.should == "master"
44
+ assert_equal "master", @project.branch
45
+ assert_equal "master", Project.new.branch
55
46
  end
56
47
 
57
48
  it "has a command" do
58
49
  # TODO: rename to build_command
59
- @project.command.should == "rake"
50
+ assert_equal "rake", @project.command
51
+ assert_equal "rake", Project.new.command
60
52
  end
61
53
 
62
- specify "command defaults to 'rake'" do
63
- Project.new.command.should == "rake"
64
- end
65
-
66
- it "has a building flag" do
67
- @project.should_not be_building
68
- end
69
-
70
- specify "building flag default to false" do
71
- Project.new.should_not be_building
54
+ it "knows wheter it is being built" do
55
+ assert ! @project.building?
72
56
  end
73
57
 
74
58
  it "knows it's visibility" do
75
59
  # TODO: rename Project#public property to visibility
76
60
  # TODO: and have utility method to query its state instead
77
61
 
78
- Project.new.should be_public
62
+ assert Project.new.public?
79
63
 
80
- @project.should be_public
81
- @project.tap { |p| p.public = "1" }.should be_public
82
- @project.tap { |p| p.public = "0" }.should_not be_public
64
+ assert @project.public?
65
+ assert Project.gen(:public => "1").public?
66
+ assert ! Project.gen(:public => "0").public?
83
67
 
84
- Project.gen(:public => "false").should be_public
85
- Project.gen(:public => "true").should be_public
86
- Project.gen(:public => false).should_not be_public
87
- Project.gen(:public => nil).should_not be_public
68
+ assert Project.gen(:public => "false").public?
69
+ assert Project.gen(:public => "true").public?
70
+ assert ! Project.gen(:public => false).public?
71
+ assert ! Project.gen(:public => nil).public?
88
72
  end
89
73
 
90
- it "has a created_at" do
91
- @project.created_at.should be_a(DateTime)
92
- end
93
-
94
- it "has an updated_at" do
95
- @project.updated_at.should be_a(DateTime)
74
+ it "has created_at and updated_at timestamps" do
75
+ assert_kind_of DateTime, @project.created_at
76
+ assert_kind_of DateTime, @project.updated_at
96
77
  end
97
78
 
98
79
  it "knows it's status" do
99
- Project.gen(:commits => 1.of{ Commit.gen(:successful) }).status.should == :success
100
- Project.gen(:commits => 2.of{ Commit.gen(:successful) }).status.should == :success
101
- Project.gen(:commits => 2.of{ Commit.gen(:failed) }).status.should == :failed
102
- Project.gen(:commits => 1.of{ Commit.gen(:pending) }).status.should == :pending
103
- Project.gen(:commits => []).status.should be_nil
80
+ assert_equal :success,
81
+ Project.gen(:commits => 1.of{ Commit.gen(:successful) }).status
82
+
83
+ assert_equal :success,
84
+ Project.gen(:commits => 2.of{ Commit.gen(:successful) }).status
85
+
86
+ assert_equal :failed,
87
+ Project.gen(:commits => 2.of{ Commit.gen(:failed) }).status
88
+
89
+ assert_equal :pending,
90
+ Project.gen(:commits => 1.of{ Commit.gen(:pending) }).status
91
+
92
+ assert_equal :blank, Project.gen(:commits => []).status
93
+
94
+ assert_equal :building,
95
+ Project.gen(:commits => 1.of{ Commit.gen(:building) }).status
96
+
97
+ commits = 3.of{Commit.gen(:successful)} << Commit.gen(:building)
98
+ assert Project.gen(:commits => commits).building?
104
99
  end
105
100
 
106
- it "knows it's last build" do
107
- Project.gen(:commits => []).last_commit.should be_nil
101
+ it "knows it's last commuit" do
102
+ assert Project.gen(:commits => []).last_commit.nil?
108
103
 
109
104
  commits = 5.of { Commit.gen(:successful) }
110
105
  project = Project.gen(:commits => commits)
111
- project.last_commit.should == commits.sort_by {|c| c.committed_at }.last
106
+ assert_equal commits.sort_by {|c| c.committed_at }.last,
107
+ project.last_commit
112
108
  end
113
109
  end
114
110
 
@@ -145,6 +141,16 @@ class ProjectTest < Test::Unit::TestCase
145
141
  end
146
142
  end
147
143
 
144
+ it "orders projects by name" do
145
+ @rails = Project.gen(:name => "rails", :public => true)
146
+ @merb = Project.gen(:name => "merb", :public => true)
147
+ @sinatra = Project.gen(:name => "sinatra", :public => true)
148
+ @camping = Project.gen(:name => "camping", :public => false)
149
+
150
+ Project.all.should == [@camping, @merb, @rails, @sinatra]
151
+ Project.all(:public => true).should == [@merb, @rails, @sinatra]
152
+ end
153
+
148
154
  describe "When finding its previous builds" do
149
155
  before(:each) do
150
156
  @project = Project.generate(:commits => 5.of { Commit.gen })
@@ -180,9 +186,8 @@ class ProjectTest < Test::Unit::TestCase
180
186
  @project = Project.generate(:commits => @commits)
181
187
  end
182
188
 
183
- it "destroys itself and tell ProjectBuilder to delete the code from disk" do
189
+ it "destroys itself" do
184
190
  lambda do
185
- stub.instance_of(ProjectBuilder).delete_code
186
191
  @project.destroy
187
192
  end.should change(Project, :count).by(-1)
188
193
  end
@@ -212,8 +217,10 @@ class ProjectTest < Test::Unit::TestCase
212
217
 
213
218
  assert_equal 2, Notifier.count
214
219
  assert_equal 2, project.enabled_notifiers.count
215
- assert_equal "IRC", project.notifiers.first.name
216
- assert_equal "Twitter", project.notifiers.last.name
220
+
221
+ sorted_notifiers = project.notifiers.sort_by{|n| n.name}
222
+ assert_equal "IRC", sorted_notifiers.first.name
223
+ assert_equal "Twitter", sorted_notifiers.last.name
217
224
 
218
225
  project.update_notifiers(["Twitter"],
219
226
  {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
@@ -231,7 +238,7 @@ class ProjectTest < Test::Unit::TestCase
231
238
 
232
239
  assert_equal 2, @project.notifiers.count
233
240
  end
234
-
241
+
235
242
  it "disables notifiers that are not included in the list" do
236
243
  @project.update_notifiers(["IRC"],
237
244
  {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
@@ -303,42 +310,4 @@ class ProjectTest < Test::Unit::TestCase
303
310
  assert ! @project.notifies?("Twitter")
304
311
  end
305
312
  end
306
-
307
- describe "When building a commit" do
308
- before(:each) do
309
- @commits = 2.of { Commit.gen }
310
- @project = Project.gen(:integrity, :commits => @commits)
311
- stub.instance_of(ProjectBuilder).build { nil }
312
- end
313
-
314
- it "gets the specified commit and creates a pending build for it" do
315
- commit = @commits.last
316
-
317
- lambda {
318
- @project.build(commit.identifier)
319
- }.should change(Build, :count).by(1)
320
-
321
- build = Build.all.last
322
- build.commit.should be(commit)
323
- build.should be_pending
324
-
325
- commit.should be_pending
326
- end
327
-
328
- it "creates an empty commit with the head of the project if passed 'HEAD' (the default)" do
329
- mock(@project).head_of_remote_repo { "FOOBAR" }
330
-
331
- lambda {
332
- @project.build("HEAD")
333
- }.should change(Commit, :count).by(1)
334
-
335
- build = Build.all.last
336
- build.commit.should == @project.last_commit
337
-
338
- @project.last_commit.should be_pending
339
- @project.last_commit.identifier.should == "FOOBAR"
340
- @project.last_commit.author.name.should == "<Commit author not loaded>"
341
- @project.last_commit.message.should == "<Commit message not loaded>"
342
- end
343
- end
344
313
  end