integrity 0.1.9.1 → 0.1.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGES +28 -0
  3. data/README.markdown +6 -0
  4. data/Rakefile +44 -83
  5. data/config/heroku/.gems +0 -3
  6. data/config/heroku/integrity-config.rb +4 -1
  7. data/integrity.gemspec +18 -6
  8. data/lib/integrity.rb +9 -5
  9. data/lib/integrity/app.rb +8 -8
  10. data/lib/integrity/build.rb +7 -7
  11. data/lib/integrity/helpers/authorization.rb +1 -1
  12. data/lib/integrity/helpers/breadcrumbs.rb +1 -1
  13. data/lib/integrity/helpers/rendering.rb +8 -2
  14. data/lib/integrity/helpers/urls.rb +33 -23
  15. data/lib/integrity/installer.rb +18 -17
  16. data/lib/integrity/notifier/base.rb +7 -2
  17. data/lib/integrity/project.rb +2 -2
  18. data/test/acceptance/api_test.rb +1 -1
  19. data/test/acceptance/browse_project_builds_test.rb +1 -1
  20. data/test/acceptance/browse_project_test.rb +1 -1
  21. data/test/acceptance/build_notifications_test.rb +1 -1
  22. data/test/acceptance/create_project_test.rb +1 -1
  23. data/test/acceptance/delete_project_test.rb +1 -1
  24. data/test/acceptance/edit_project_test.rb +1 -1
  25. data/test/acceptance/error_page_test.rb +1 -1
  26. data/test/acceptance/installer_test.rb +2 -6
  27. data/test/acceptance/manual_build_project_test.rb +1 -1
  28. data/test/acceptance/not_found_page_test.rb +29 -0
  29. data/test/acceptance/notifier_test.rb +1 -1
  30. data/test/acceptance/project_syndication_test.rb +1 -1
  31. data/test/acceptance/stylesheet_test.rb +10 -2
  32. data/test/acceptance/unauthorized_page_test.rb +20 -0
  33. data/test/helpers.rb +13 -7
  34. data/test/helpers/acceptance.rb +1 -0
  35. data/test/unit/build_test.rb +10 -0
  36. data/test/unit/helpers_test.rb +63 -20
  37. data/test/unit/integrity_test.rb +23 -6
  38. data/test/unit/notifier_test.rb +5 -0
  39. data/test/unit/project_test.rb +5 -0
  40. data/views/home.haml +2 -2
  41. data/views/layout.haml +6 -5
  42. data/views/new.haml +1 -1
  43. data/views/not_found.haml +2 -2
  44. data/views/unauthorized.haml +4 -4
  45. metadata +105 -6
  46. data/test/acceptance/helpers.rb +0 -2
  47. data/vendor/sinatra-ditties/README.rdoc +0 -3
  48. data/vendor/sinatra-ditties/lib/sinatra/ditties.rb +0 -12
  49. data/vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb +0 -61
  50. data/vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb +0 -146
@@ -1,25 +1,68 @@
1
1
  require File.dirname(__FILE__) + "/../helpers"
2
2
 
3
3
  class BrowsePublicProjectsTest < Test::Unit::TestCase
4
- include ::Integrity::Helpers
4
+ setup do
5
+ @h = Module.new { extend Integrity::Helpers }
6
+ end
5
7
 
6
8
  test "#pretty_date" do
7
- pretty_date(Time.now).should == "today"
8
- pretty_date(Time.new - 86400).should == "yesterday"
9
+ @h.pretty_date(Time.now).should == "today"
10
+ @h.pretty_date(Time.new - 86400).should == "yesterday"
11
+
12
+ @h.pretty_date(Time.mktime(1995, 12, 01)).should == "on Dec 01st"
13
+ @h.pretty_date(Time.mktime(1995, 12, 21)).should == "on Dec 21st"
14
+ @h.pretty_date(Time.mktime(1995, 12, 31)).should == "on Dec 31st"
15
+
16
+ @h.pretty_date(Time.mktime(1995, 12, 22)).should == "on Dec 22nd"
17
+ @h.pretty_date(Time.mktime(1995, 12, 22)).should == "on Dec 22nd"
18
+
19
+ @h.pretty_date(Time.mktime(1995, 12, 03)).should == "on Dec 03rd"
20
+ @h.pretty_date(Time.mktime(1995, 12, 23)).should == "on Dec 23rd"
21
+
22
+ @h.pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
23
+ @h.pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
24
+ @h.pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
25
+ end
26
+
27
+ describe "urls" do
28
+ before do
29
+ Integrity.config[:base_uri] = "http://example.org/ci"
30
+
31
+ @project = Project.gen(:name => "Foo Bar")
32
+ @build = Build.gen(:successful)
33
+ @commit = @build.commit
34
+ end
35
+
36
+ test "root" do
37
+ assert_equal "http://example.org/ci", @h.root_url.to_s
38
+ assert_equal "/ci", @h.root_path
39
+ assert_equal "/ci/stylesheet.css", @h.root_path("/stylesheet.css")
9
40
 
10
- pretty_date(Time.mktime(1995, 12, 01)).should == "on Dec 01st"
11
- pretty_date(Time.mktime(1995, 12, 21)).should == "on Dec 21st"
12
- pretty_date(Time.mktime(1995, 12, 31)).should == "on Dec 31st"
41
+ Integrity.config[:base_uri] = nil
42
+ @h.instance_variable_set(:@url, nil)
43
+ lambda { @h.root_url }.should raise_error
44
+
45
+ stub(@h).request { OpenStruct.new(:url => "http://0.0.0.0/") }
46
+ assert_equal "http://0.0.0.0/", @h.root_url.to_s
47
+ end
13
48
 
14
- pretty_date(Time.mktime(1995, 12, 22)).should == "on Dec 22nd"
15
- pretty_date(Time.mktime(1995, 12, 22)).should == "on Dec 22nd"
49
+ test "project" do
50
+ assert_equal "/ci/foo-bar", @h.project_path(@project)
51
+ assert_equal "http://example.org/ci/foo-bar",
52
+ @h.project_url(@project).to_s
53
+ end
16
54
 
17
- pretty_date(Time.mktime(1995, 12, 03)).should == "on Dec 03rd"
18
- pretty_date(Time.mktime(1995, 12, 23)).should == "on Dec 23rd"
55
+ test "commit" do
56
+ assert_equal "/ci/foo-bar/commits/#{@commit.identifier}",
57
+ @h.commit_path(@build.commit)
58
+ assert_equal "http://example.org/ci/foo-bar/commits/#{@commit.identifier}",
59
+ @h.commit_url(@build.commit).to_s
60
+ end
19
61
 
20
- pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
21
- pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
22
- pretty_date(Time.mktime(1995, 12, 15)).should == "on Dec 15th"
62
+ test "compat" do
63
+ assert_equal @h.build_path(@build), @h.commit_path(@build.commit)
64
+ assert_equal @h.build_url(@build), @h.commit_url(@build.commit)
65
+ end
23
66
  end
24
67
 
25
68
  describe "#push_url_for" do
@@ -27,30 +70,30 @@ class BrowsePublicProjectsTest < Test::Unit::TestCase
27
70
  @project = Project.gen(:integrity)
28
71
  Integrity.config[:admin_username] = "admin"
29
72
  Integrity.config[:admin_password] = "test"
30
-
31
- stub(self).request {
32
- OpenStruct.new(:url => "http://integrity.example.org:1234")
33
- }
73
+ Integrity.config[:base_uri] = "http://integrity.example.org:1234"
34
74
  end
35
75
 
36
76
  test "with auth disabled" do
37
77
  Integrity.config[:use_basic_auth] = false
38
78
 
39
- push_url_for(@project).should == "http://integrity.example.org:1234/integrity/push"
79
+ assert_equal "http://integrity.example.org:1234/integrity/push",
80
+ @h.push_url_for(@project)
40
81
  end
41
82
 
42
83
  test "with auth and hashing enabled" do
43
84
  Integrity.config[:use_basic_auth] = true
44
85
  Integrity.config[:hash_admin_password] = true
45
86
 
46
- push_url_for(@project).should == "http://admin:<password>@integrity.example.org:1234/integrity/push"
87
+ assert_equal "http://admin:<password>@integrity.example.org:1234/integrity/push",
88
+ @h.push_url_for(@project)
47
89
  end
48
90
 
49
91
  test "with auth enabled and hashing disabled" do
50
92
  Integrity.config[:use_basic_auth] = true
51
93
  Integrity.config[:hash_admin_password] = false
52
94
 
53
- push_url_for(@project).should == "http://admin:test@integrity.example.org:1234/integrity/push"
95
+ assert_equal "http://admin:test@integrity.example.org:1234/integrity/push",
96
+ @h.push_url_for(@project)
54
97
  end
55
98
  end
56
99
  end
@@ -1,14 +1,31 @@
1
1
  require File.dirname(__FILE__) + "/../helpers"
2
2
 
3
3
  class IntegrityTest < Test::Unit::TestCase
4
- test "Integrity.new loads configuration from a file" do
5
- stub(DataMapper).setup { nil }
4
+ describe "#new" do
5
+ setup do
6
+ stub(DataMapper).setup { nil }
7
+ @config_file = File.dirname(__FILE__) + "/../../config/config.sample.yml"
8
+ end
6
9
 
7
- file = File.dirname(__FILE__) + "/../../config/config.sample.yml"
8
- Integrity.new(file)
10
+ it "doesn't require any argument" do
11
+ Integrity.new
9
12
 
10
- Integrity.config[:base_uri].should == "http://integrity.domain.tld"
11
- Integrity.config[:export_directory].should == "/path/to/scm/exports"
13
+ assert_equal Integrity.default_configuration[:log],
14
+ Integrity.config[:log]
15
+ end
16
+
17
+ it "loads configuration from a file" do
18
+ Integrity.new(@config_file)
19
+
20
+ assert_equal "http://integrity.domain.tld", Integrity.config[:base_uri]
21
+ assert_equal "/path/to/scm/exports", Integrity.config[:export_directory]
22
+ end
23
+
24
+ it "takes configuration as an hash" do
25
+ Integrity.new(:base_uri => "http://foo.org")
26
+
27
+ assert_equal "http://foo.org", Integrity.config[:base_uri]
28
+ end
12
29
  end
13
30
 
14
31
  specify "config is just a hash" do
@@ -1,6 +1,11 @@
1
1
  require File.dirname(__FILE__) + "/../helpers"
2
2
 
3
3
  class NotifierTest < Test::Unit::TestCase
4
+ test "deprecated methods" do
5
+ Notifier::Base.new(Build.gen, {}).should respond_to(:build)
6
+ Notifier::Base.new(Build.gen, {}).should respond_to(:build_url)
7
+ end
8
+
4
9
  specify "IRC fixture is valid and can be saved" do
5
10
  lambda do
6
11
  Notifier.generate(:irc).tap do |project|
@@ -110,6 +110,11 @@ class ProjectTest < Test::Unit::TestCase
110
110
  project = Project.gen(:commits => commits)
111
111
  project.last_commit.should == commits.sort_by {|c| c.committed_at }.last
112
112
  end
113
+
114
+ test "deprecated properties" do
115
+ @project.last_build.should == @project.last_commit
116
+ @project.previous_builds.should == @project.previous_commits
117
+ end
113
118
  end
114
119
 
115
120
  describe "Validation" do
@@ -4,7 +4,7 @@
4
4
  %h1
5
5
  Why don't you
6
6
  = succeed "?" do
7
- %a{ :href => "/new" } create your first project
7
+ %a{ :href => root_path("/new") } create your first project
8
8
  - else
9
9
  %ul#projects
10
10
  - @projects.each do |project|
@@ -18,4 +18,4 @@
18
18
  - else
19
19
  = project.human_readable_status
20
20
  %p#new
21
- %a{ :href => "/new" } Add a new project
21
+ %a{ :href => root_path("/new") } Add a new project
@@ -4,11 +4,12 @@
4
4
  %meta{ :content => "text/html; charset=utf-8", :"http-equiv" => "Content-Type" }
5
5
  %meta{ :content => "en", :"http-equiv" => "Content-Language" }
6
6
  %title= "#{@title.last} | integrity"
7
- %link{ :media => "screen", :type => "text/css", :href => "/reset.css", :rel => "stylesheet" }
8
- %link{ :media => "screen", :type => "text/css", :href => "/buttons.css", :rel => "stylesheet" }
9
- %link{ :media => "screen", :type => "text/css", :href => "/integrity.css", :rel => "stylesheet" }
7
+ - stylesheets(:reset, :buttons, :integrity)
10
8
  - unless @project.nil?
11
- %link{ :rel => "alternate", :type => "application/atom+xml", :title => "Build history Atom", :href => "#{project_path(@project)}.atom"}
9
+ %link{ :rel => "alternate", |
10
+ :type => "application/atom+xml", |
11
+ :title => "Build history Atom", |
12
+ :href => "#{project_path(@project)}.atom"} |
12
13
 
13
14
  %body
14
15
  #header
@@ -24,5 +25,5 @@
24
25
  %strong&= current_user
25
26
  - else
26
27
  Hey there!
27
- %a{ :href => "/login" } Log In
28
+ %a{ :href => root_path("/login") } Log In
28
29
  if you have a user
@@ -1,4 +1,4 @@
1
- %form{ :method => "post", :action => (@project.new_record? ? "/" : project_path(@project)) }
1
+ %form{ :method => "post", :action => (@project.new_record? ? root_path("/") : project_path(@project)) }
2
2
  - unless @project.new_record?
3
3
  .hidden
4
4
  %input{ :name => "_method", :type => "hidden", :value => "put" }
@@ -1,7 +1,7 @@
1
1
  .error
2
2
  %h1
3
3
  Ehm, you seem a bit lost, sir. Maybe going to the
4
- %a{ :href => "/", :rel => "home" } list of projects
4
+ %a{ :href => root_path("/"), :rel => "home" } list of projects
5
5
  will help?
6
6
  %dl
7
7
  %dt Ouch. This is a 404 error-thingie, right?
@@ -14,7 +14,7 @@
14
14
  %strong DON'T PANIC
15
15
  / if you didn't get the reference you aren't as nerd as you should be
16
16
  You should probably just go back to
17
- %a{ :href => "/", :rel => "home" } the projects list
17
+ %a{ :href => root_path("/"), :rel => "home" } the projects list
18
18
  or, alternatively, go
19
19
  = succeed "." do
20
20
  %a{ :href => request.referer } back from whence you came
@@ -1,10 +1,10 @@
1
1
  .error
2
2
  %h1
3
3
  So... you don't know the password? Hmm... You can
4
- %a{ :href => "/login" } try again
4
+ %a{ :href => root_path("/login") } try again
5
5
  or
6
6
  = succeed "." do
7
- %a{ :href => "/", :rel => "home" } go back
7
+ %a{ :href => root_path("/"), :rel => "home" } go back
8
8
 
9
9
  %dl
10
10
  %dt Er... So... I'm trying to login without a password...
@@ -19,12 +19,12 @@
19
19
  %dd
20
20
  This just means that you can't access some part of this Integrity
21
21
  server, but that shouldn't let you out of some of the
22
- %a{ :href => "/" } awesome projects
22
+ %a{ :href => root_path("/") } awesome projects
23
23
  hosted here. If this was just a misunderstanding and you
24
24
  %strong do
25
25
  have a password, then
26
26
  = succeed "." do
27
- %a{ :href => "/login" } click here to try again
27
+ %a{ :href => root_path("/login") } click here to try again
28
28
 
29
29
  %dt
30
30
  So what the hell is
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integrity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9.1
4
+ version: 0.1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Nicol\xC3\xA1s Sanguinetti"
@@ -23,6 +23,16 @@ dependencies:
23
23
  - !ruby/object:Gem::Version
24
24
  version: 0.9.1.1
25
25
  version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: sinatra-authorization
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ version:
26
36
  - !ruby/object:Gem::Dependency
27
37
  name: haml
28
38
  type: :runtime
@@ -83,6 +93,96 @@ dependencies:
83
93
  - !ruby/object:Gem::Version
84
94
  version: "0"
85
95
  version:
96
+ - !ruby/object:Gem::Dependency
97
+ name: rr
98
+ type: :development
99
+ version_requirement:
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: "0"
105
+ version:
106
+ - !ruby/object:Gem::Dependency
107
+ name: mocha
108
+ type: :development
109
+ version_requirement:
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: "0"
115
+ version:
116
+ - !ruby/object:Gem::Dependency
117
+ name: webrat
118
+ type: :development
119
+ version_requirement:
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: "0"
125
+ version:
126
+ - !ruby/object:Gem::Dependency
127
+ name: do_sqlite3
128
+ type: :development
129
+ version_requirement:
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: "0"
135
+ version:
136
+ - !ruby/object:Gem::Dependency
137
+ name: dm-sweatshop
138
+ type: :development
139
+ version_requirement:
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: "0"
145
+ version:
146
+ - !ruby/object:Gem::Dependency
147
+ name: ParseTree
148
+ type: :development
149
+ version_requirement:
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: "0"
155
+ version:
156
+ - !ruby/object:Gem::Dependency
157
+ name: jeremymcanally-context
158
+ type: :development
159
+ version_requirement:
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: "0"
165
+ version:
166
+ - !ruby/object:Gem::Dependency
167
+ name: jeremymcanally-pending
168
+ type: :development
169
+ version_requirement:
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: "0"
175
+ version:
176
+ - !ruby/object:Gem::Dependency
177
+ name: foca-storyteller
178
+ type: :development
179
+ version_requirement:
180
+ version_requirements: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: "0"
185
+ version:
86
186
  description: Your Friendly Continuous Integration server. Easy, fun and painless!
87
187
  email: info@integrityapp.com
88
188
  executables:
@@ -92,6 +192,8 @@ extensions: []
92
192
  extra_rdoc_files: []
93
193
 
94
194
  files:
195
+ - .gitignore
196
+ - CHANGES
95
197
  - README.markdown
96
198
  - Rakefile
97
199
  - bin/integrity
@@ -140,12 +242,13 @@ files:
140
242
  - test/acceptance/delete_project_test.rb
141
243
  - test/acceptance/edit_project_test.rb
142
244
  - test/acceptance/error_page_test.rb
143
- - test/acceptance/helpers.rb
144
245
  - test/acceptance/installer_test.rb
145
246
  - test/acceptance/manual_build_project_test.rb
247
+ - test/acceptance/not_found_page_test.rb
146
248
  - test/acceptance/notifier_test.rb
147
249
  - test/acceptance/project_syndication_test.rb
148
250
  - test/acceptance/stylesheet_test.rb
251
+ - test/acceptance/unauthorized_page_test.rb
149
252
  - test/helpers.rb
150
253
  - test/helpers/acceptance.rb
151
254
  - test/helpers/acceptance/email_notifier.rb
@@ -168,10 +271,6 @@ files:
168
271
  - test/unit/project_builder_test.rb
169
272
  - test/unit/project_test.rb
170
273
  - test/unit/scm_test.rb
171
- - vendor/sinatra-ditties/README.rdoc
172
- - vendor/sinatra-ditties/lib/sinatra/ditties.rb
173
- - vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb
174
- - vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb
175
274
  - views/_commit_info.haml
176
275
  - views/build.haml
177
276
  - views/error.haml
@@ -1,2 +0,0 @@
1
- require File.dirname(__FILE__) + "/../helpers"
2
- require File.dirname(__FILE__) / ".." / "helpers" / "acceptance"
@@ -1,3 +0,0 @@
1
- = Sinatra Ditties
2
-
3
- All those handy tunes in one elegant package.
@@ -1,12 +0,0 @@
1
- require "sinatra/base"
2
-
3
- module Sinatra
4
- module Ditties
5
- def self.version
6
- "0.0.2".freeze
7
- end
8
- end
9
-
10
- autoload :Authorization, File.dirname(__FILE__) + "/ditties/authorization"
11
- autoload :Mailer, File.dirname(__FILE__) + "/ditties/mailer"
12
- end