foca-integrity 0.1.9.2 → 0.1.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +15 -1
- data/{README.markdown → README.md} +5 -2
- data/Rakefile +7 -29
- data/integrity.gemspec +9 -6
- data/lib/integrity.rb +4 -4
- data/lib/integrity/app.rb +1 -1
- data/lib/integrity/build.rb +2 -41
- data/lib/integrity/commit.rb +7 -10
- data/lib/integrity/helpers/breadcrumbs.rb +1 -1
- data/lib/integrity/helpers/forms.rb +7 -6
- data/lib/integrity/helpers/resources.rb +1 -1
- data/lib/integrity/installer.rb +6 -1
- data/lib/integrity/migrations.rb +13 -2
- data/lib/integrity/notifier.rb +16 -20
- data/lib/integrity/notifier/base.rb +2 -2
- data/lib/integrity/project.rb +6 -59
- data/lib/integrity/project/notifiers.rb +33 -0
- data/lib/integrity/project/push.rb +44 -0
- data/test/acceptance/browse_project_test.rb +4 -0
- data/test/acceptance/build_notifications_test.rb +57 -4
- data/test/acceptance/installer_test.rb +4 -1
- data/test/helpers.rb +28 -39
- data/test/helpers/acceptance.rb +4 -0
- data/test/helpers/acceptance/notifier_helper.rb +47 -0
- data/test/unit/build_test.rb +0 -12
- data/test/unit/commit_test.rb +4 -0
- data/test/unit/migrations_test.rb +3 -2
- data/test/unit/notifier/base_test.rb +43 -0
- data/test/unit/notifier_test.rb +18 -49
- data/test/unit/project_test.rb +95 -21
- data/views/_commit_info.haml +1 -1
- data/views/new.haml +1 -2
- metadata +19 -7
- data/test/acceptance/notifier_test.rb +0 -109
- data/test/helpers/fixtures.rb +0 -87
@@ -1,109 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + "/../helpers/acceptance"
|
2
|
-
|
3
|
-
class NotifierConfigIssues < Test::Unit::AcceptanceTestCase
|
4
|
-
story <<-EOS
|
5
|
-
As an administrator,
|
6
|
-
I want to add multiple projects to Integrity,
|
7
|
-
So that I can be certain notifiers remain functional (cf #43)
|
8
|
-
EOS
|
9
|
-
|
10
|
-
before(:each) do
|
11
|
-
# This is needed before any available notifier is unset
|
12
|
-
# in the global #before
|
13
|
-
load File.dirname(__FILE__) + "/../helpers/acceptance/email_notifier.rb"
|
14
|
-
end
|
15
|
-
|
16
|
-
def fill_in_email_notifier
|
17
|
-
fill_in "notifiers[Email][to]", :with => "quentin@example.com"
|
18
|
-
fill_in "notifiers[Email][from]", :with => "ci@example.com"
|
19
|
-
fill_in "notifiers[Email][user]", :with => "inspector"
|
20
|
-
fill_in "notifiers[Email][pass]", :with => "gadget"
|
21
|
-
fill_in "notifiers[Email][auth]", :with => "simple"
|
22
|
-
fill_in "notifiers[Email][domain]", :with => "example.com"
|
23
|
-
end
|
24
|
-
|
25
|
-
def fill_in_project_info(name, repo)
|
26
|
-
fill_in "Name", :with => name
|
27
|
-
fill_in "Git repository", :with => repo
|
28
|
-
fill_in "Branch to track", :with => "master"
|
29
|
-
fill_in "Build script", :with => "rake"
|
30
|
-
check "Public project"
|
31
|
-
|
32
|
-
fill_in_email_notifier
|
33
|
-
end
|
34
|
-
|
35
|
-
def assert_have_email_notifier
|
36
|
-
assert_have_tag "input#email_notifier_to[@value='quentin@example.com']"
|
37
|
-
assert_have_tag "input#email_notifier_from[@value='ci@example.com']"
|
38
|
-
assert_have_tag "input#email_notifier_user[@value='inspector']"
|
39
|
-
assert_have_tag "input#email_notifier_pass[@value='gadget']"
|
40
|
-
assert_have_tag "input#email_notifier_auth[@value='simple']"
|
41
|
-
assert_have_tag "input#email_notifier_domain[@value='example.com']"
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_project(name, repo)
|
45
|
-
visit "/new"
|
46
|
-
fill_in_project_info(name, repo)
|
47
|
-
click_button "Create Project"
|
48
|
-
|
49
|
-
assert_have_tag("h1", :content => name)
|
50
|
-
click_link 'Edit Project'
|
51
|
-
assert_have_email_notifier
|
52
|
-
end
|
53
|
-
|
54
|
-
def edit_project(name)
|
55
|
-
visit "/#{name}"
|
56
|
-
click_link "Edit Project"
|
57
|
-
assert_have_email_notifier
|
58
|
-
fill_in :branch, :with => "testing"
|
59
|
-
click_button "Update Project"
|
60
|
-
end
|
61
|
-
|
62
|
-
scenario "an admin can create a public project and retain mailer info" do
|
63
|
-
Project.first(:permalink => "integrity").should be_nil
|
64
|
-
|
65
|
-
login_as "admin", "test"
|
66
|
-
|
67
|
-
visit "/"
|
68
|
-
add_project "Integrity", "git://github.com/foca/integrity.git"
|
69
|
-
edit_project "integrity"
|
70
|
-
|
71
|
-
visit "/integrity"
|
72
|
-
click_link "Edit Project"
|
73
|
-
|
74
|
-
assert_have_email_notifier
|
75
|
-
end
|
76
|
-
|
77
|
-
scenario "an admin can create multiple public projects" do
|
78
|
-
Project.first(:permalink => "integrity").should be_nil
|
79
|
-
|
80
|
-
login_as "admin", "test"
|
81
|
-
|
82
|
-
visit "/"
|
83
|
-
|
84
|
-
add_project "Integrity", "git://github.com/foca/integrity.git"
|
85
|
-
click_link "projects"
|
86
|
-
|
87
|
-
add_project "Webrat", "git://github.com/brynary/webrat.git"
|
88
|
-
click_link "projects"
|
89
|
-
|
90
|
-
add_project "Rails", "git://github.com/rails/rails.git"
|
91
|
-
click_link "projects"
|
92
|
-
|
93
|
-
edit_project "integrity"
|
94
|
-
edit_project "webrat"
|
95
|
-
edit_project "rails"
|
96
|
-
|
97
|
-
visit "/integrity"
|
98
|
-
click_link "Edit Project"
|
99
|
-
assert_have_email_notifier
|
100
|
-
|
101
|
-
visit "/webrat"
|
102
|
-
click_link "Edit Project"
|
103
|
-
assert_have_email_notifier
|
104
|
-
|
105
|
-
visit "/rails"
|
106
|
-
click_link "Edit Project"
|
107
|
-
assert_have_email_notifier
|
108
|
-
end
|
109
|
-
end
|
data/test/helpers/fixtures.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
Integrity::Project.fixture do
|
2
|
-
{ :name => (name = unique { /\w+/.gen }),
|
3
|
-
:uri => "git://github.com/#{/\w+/.gen}/#{name}.git",
|
4
|
-
:branch => ["master", "test-refactoring", "lh-34"].pick,
|
5
|
-
:command => ["rake", "make", "ant -buildfile test.xml"].pick,
|
6
|
-
:public => [true, false].pick,
|
7
|
-
:building => [true, false].pick }
|
8
|
-
end
|
9
|
-
|
10
|
-
Integrity::Project.fixture(:integrity) do
|
11
|
-
{ :name => "Integrity",
|
12
|
-
:uri => "git://github.com/foca/integrity.git",
|
13
|
-
:branch => "master",
|
14
|
-
:command => "rake",
|
15
|
-
:public => true,
|
16
|
-
:building => false }
|
17
|
-
end
|
18
|
-
|
19
|
-
Integrity::Project.fixture(:my_test_project) do
|
20
|
-
{ :name => "My Test Project",
|
21
|
-
:uri => File.dirname(__FILE__) + "/../../",
|
22
|
-
:branch => "master",
|
23
|
-
:command => "./test",
|
24
|
-
:public => true,
|
25
|
-
:building => false }
|
26
|
-
end
|
27
|
-
|
28
|
-
Integrity::Commit.fixture do
|
29
|
-
project = Integrity::Project.first || Integrity::Project.gen
|
30
|
-
|
31
|
-
{ :identifier => Digest::SHA1.hexdigest(/[:paragraph:]/.gen),
|
32
|
-
:message => /[:sentence:]/.gen,
|
33
|
-
:author => /\w+ \w+ <\w+@example.org>/.gen,
|
34
|
-
:committed_at => unique {|i| Time.mktime(2008, 12, 15, 18, (59 - i) % 60) },
|
35
|
-
:project_id => project.id }
|
36
|
-
end
|
37
|
-
|
38
|
-
Integrity::Commit.fixture(:successful) do
|
39
|
-
Integrity::Commit.generate_attributes.update(:build => Integrity::Build.gen(:successful))
|
40
|
-
end
|
41
|
-
|
42
|
-
Integrity::Commit.fixture(:failed) do
|
43
|
-
Integrity::Commit.generate_attributes.update(:build => Integrity::Build.gen(:failed))
|
44
|
-
end
|
45
|
-
|
46
|
-
Integrity::Commit.fixture(:pending) do
|
47
|
-
Integrity::Commit.generate_attributes.update(:build => Integrity::Build.gen(:pending))
|
48
|
-
end
|
49
|
-
|
50
|
-
Integrity::Build.fixture do
|
51
|
-
commit = Integrity::Commit.first || Integrity::Commit.gen
|
52
|
-
|
53
|
-
{ :output => /[:paragraph:]/.gen,
|
54
|
-
:successful => true,
|
55
|
-
:started_at => unique {|i| Time.mktime(2008, 12, 15, 18, i % 60) },
|
56
|
-
:created_at => unique {|i| Time.mktime(2008, 12, 15, 18, i % 60) },
|
57
|
-
:completed_at => unique {|i| Time.mktime(2008, 12, 15, 18, i % 60) },
|
58
|
-
:commit_id => commit.id }
|
59
|
-
end
|
60
|
-
|
61
|
-
Integrity::Build.fixture(:successful) do
|
62
|
-
Integrity::Build.generate_attributes.update(:successful => true)
|
63
|
-
end
|
64
|
-
|
65
|
-
Integrity::Build.fixture(:failed) do
|
66
|
-
Integrity::Build.generate_attributes.update(:successful => false)
|
67
|
-
end
|
68
|
-
|
69
|
-
Integrity::Build.fixture(:pending) do
|
70
|
-
Integrity::Build.generate_attributes.update(:successful => nil, :started_at => nil, :completed_at => nil)
|
71
|
-
end
|
72
|
-
|
73
|
-
Integrity::Notifier.fixture(:irc) do
|
74
|
-
create_notifier! "IRC"
|
75
|
-
|
76
|
-
{ :project => Integrity::Project.generate,
|
77
|
-
:name => "IRC",
|
78
|
-
:config => { :uri => "irc://irc.freenode.net/integrity" }}
|
79
|
-
end
|
80
|
-
|
81
|
-
Integrity::Notifier.fixture(:twitter) do
|
82
|
-
create_notifier! "Twitter"
|
83
|
-
|
84
|
-
{ :project => Integrity::Project.generate,
|
85
|
-
:name => "Twitter",
|
86
|
-
:config => { :email => "foo@example.org", :pass => "secret" }}
|
87
|
-
end
|