integrity 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. data/README.markdown +7 -0
  2. data/Rakefile +59 -132
  3. data/VERSION.yml +1 -1
  4. data/config/config.ru +29 -0
  5. data/config/config.sample.ru +6 -16
  6. data/config/config.sample.yml +15 -12
  7. data/config/config.yml +34 -0
  8. data/lib/integrity.rb +13 -13
  9. data/lib/integrity/app.rb +138 -0
  10. data/lib/integrity/author.rb +39 -0
  11. data/lib/integrity/build.rb +54 -31
  12. data/lib/integrity/commit.rb +71 -0
  13. data/lib/integrity/helpers.rb +3 -3
  14. data/lib/integrity/helpers/authorization.rb +2 -2
  15. data/lib/integrity/helpers/forms.rb +3 -3
  16. data/lib/integrity/helpers/pretty_output.rb +1 -1
  17. data/lib/integrity/helpers/rendering.rb +6 -1
  18. data/lib/integrity/helpers/resources.rb +9 -3
  19. data/lib/integrity/helpers/urls.rb +15 -13
  20. data/lib/integrity/installer.rb +45 -56
  21. data/lib/integrity/migrations.rb +31 -48
  22. data/lib/integrity/notifier.rb +14 -16
  23. data/lib/integrity/notifier/base.rb +29 -19
  24. data/lib/integrity/notifier/test_helpers.rb +100 -0
  25. data/lib/integrity/project.rb +69 -33
  26. data/lib/integrity/project_builder.rb +23 -14
  27. data/lib/integrity/scm/git.rb +15 -14
  28. data/lib/integrity/scm/git/uri.rb +9 -9
  29. data/test/acceptance/api_test.rb +97 -0
  30. data/test/acceptance/browse_project_builds_test.rb +65 -0
  31. data/test/acceptance/browse_project_test.rb +95 -0
  32. data/test/acceptance/build_notifications_test.rb +42 -0
  33. data/test/acceptance/create_project_test.rb +97 -0
  34. data/test/acceptance/delete_project_test.rb +53 -0
  35. data/test/acceptance/edit_project_test.rb +117 -0
  36. data/test/acceptance/error_page_test.rb +18 -0
  37. data/test/acceptance/helpers.rb +2 -0
  38. data/test/acceptance/installer_test.rb +62 -0
  39. data/test/acceptance/manual_build_project_test.rb +82 -0
  40. data/test/acceptance/notifier_test.rb +109 -0
  41. data/test/acceptance/project_syndication_test.rb +30 -0
  42. data/test/acceptance/stylesheet_test.rb +18 -0
  43. data/test/helpers.rb +59 -26
  44. data/test/helpers/acceptance.rb +19 -65
  45. data/test/helpers/acceptance/email_notifier.rb +55 -0
  46. data/test/helpers/acceptance/git_helper.rb +15 -15
  47. data/test/helpers/acceptance/textfile_notifier.rb +3 -3
  48. data/test/helpers/expectations.rb +0 -1
  49. data/test/helpers/expectations/be_a.rb +4 -4
  50. data/test/helpers/expectations/change.rb +5 -5
  51. data/test/helpers/expectations/have.rb +4 -4
  52. data/test/helpers/expectations/predicates.rb +4 -4
  53. data/test/helpers/fixtures.rb +44 -18
  54. data/test/helpers/initial_migration_fixture.sql +44 -0
  55. data/test/unit/build_test.rb +51 -0
  56. data/test/unit/commit_test.rb +83 -0
  57. data/test/unit/helpers_test.rb +56 -0
  58. data/test/unit/integrity_test.rb +18 -0
  59. data/test/unit/migrations_test.rb +56 -0
  60. data/test/unit/notifier_test.rb +123 -0
  61. data/test/unit/project_builder_test.rb +108 -0
  62. data/test/unit/project_test.rb +282 -0
  63. data/test/unit/scm_test.rb +54 -0
  64. data/vendor/webrat/History.txt +306 -0
  65. data/vendor/webrat/MIT-LICENSE.txt +19 -0
  66. data/vendor/webrat/README.rdoc +85 -0
  67. data/vendor/webrat/Rakefile +151 -0
  68. data/vendor/webrat/install.rb +1 -0
  69. data/vendor/webrat/lib/webrat.rb +34 -0
  70. data/vendor/webrat/lib/webrat/core.rb +14 -0
  71. data/vendor/webrat/lib/webrat/core/configuration.rb +98 -0
  72. data/vendor/webrat/lib/webrat/core/elements/area.rb +31 -0
  73. data/vendor/webrat/lib/webrat/core/elements/element.rb +33 -0
  74. data/vendor/webrat/lib/webrat/core/elements/field.rb +403 -0
  75. data/vendor/webrat/lib/webrat/core/elements/form.rb +103 -0
  76. data/vendor/webrat/lib/webrat/core/elements/label.rb +31 -0
  77. data/vendor/webrat/lib/webrat/core/elements/link.rb +90 -0
  78. data/vendor/webrat/lib/webrat/core/elements/select_option.rb +35 -0
  79. data/vendor/webrat/lib/webrat/core/locators.rb +20 -0
  80. data/vendor/webrat/lib/webrat/core/locators/area_locator.rb +38 -0
  81. data/vendor/webrat/lib/webrat/core/locators/button_locator.rb +54 -0
  82. data/vendor/webrat/lib/webrat/core/locators/field_by_id_locator.rb +37 -0
  83. data/vendor/webrat/lib/webrat/core/locators/field_labeled_locator.rb +56 -0
  84. data/vendor/webrat/lib/webrat/core/locators/field_locator.rb +25 -0
  85. data/vendor/webrat/lib/webrat/core/locators/field_named_locator.rb +41 -0
  86. data/vendor/webrat/lib/webrat/core/locators/form_locator.rb +19 -0
  87. data/vendor/webrat/lib/webrat/core/locators/label_locator.rb +34 -0
  88. data/vendor/webrat/lib/webrat/core/locators/link_locator.rb +66 -0
  89. data/vendor/webrat/lib/webrat/core/locators/locator.rb +20 -0
  90. data/vendor/webrat/lib/webrat/core/locators/select_option_locator.rb +59 -0
  91. data/vendor/webrat/lib/webrat/core/logging.rb +21 -0
  92. data/vendor/webrat/lib/webrat/core/matchers.rb +4 -0
  93. data/vendor/webrat/lib/webrat/core/matchers/have_content.rb +73 -0
  94. data/vendor/webrat/lib/webrat/core/matchers/have_selector.rb +74 -0
  95. data/vendor/webrat/lib/webrat/core/matchers/have_tag.rb +21 -0
  96. data/vendor/webrat/lib/webrat/core/matchers/have_xpath.rb +147 -0
  97. data/vendor/webrat/lib/webrat/core/methods.rb +61 -0
  98. data/vendor/webrat/lib/webrat/core/mime.rb +29 -0
  99. data/vendor/webrat/lib/webrat/core/save_and_open_page.rb +50 -0
  100. data/vendor/webrat/lib/webrat/core/scope.rb +350 -0
  101. data/vendor/webrat/lib/webrat/core/session.rb +281 -0
  102. data/vendor/webrat/lib/webrat/core/xml.rb +115 -0
  103. data/vendor/webrat/lib/webrat/core/xml/hpricot.rb +19 -0
  104. data/vendor/webrat/lib/webrat/core/xml/nokogiri.rb +76 -0
  105. data/vendor/webrat/lib/webrat/core/xml/rexml.rb +24 -0
  106. data/vendor/webrat/lib/webrat/core_extensions/blank.rb +58 -0
  107. data/vendor/webrat/lib/webrat/core_extensions/deprecate.rb +8 -0
  108. data/vendor/webrat/lib/webrat/core_extensions/detect_mapped.rb +12 -0
  109. data/vendor/webrat/lib/webrat/core_extensions/meta_class.rb +6 -0
  110. data/vendor/webrat/lib/webrat/core_extensions/nil_to_param.rb +5 -0
  111. data/vendor/webrat/lib/webrat/mechanize.rb +74 -0
  112. data/vendor/webrat/lib/webrat/merb.rb +9 -0
  113. data/vendor/webrat/lib/webrat/merb_session.rb +65 -0
  114. data/vendor/webrat/lib/webrat/rack.rb +24 -0
  115. data/vendor/webrat/lib/webrat/rails.rb +105 -0
  116. data/vendor/webrat/lib/webrat/rspec-rails.rb +13 -0
  117. data/vendor/webrat/lib/webrat/selenium.rb +154 -0
  118. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +12 -0
  119. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +16 -0
  120. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +5 -0
  121. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +9 -0
  122. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +15 -0
  123. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +5 -0
  124. data/vendor/webrat/lib/webrat/selenium/matchers.rb +4 -0
  125. data/vendor/webrat/lib/webrat/selenium/matchers/have_content.rb +66 -0
  126. data/vendor/webrat/lib/webrat/selenium/matchers/have_selector.rb +49 -0
  127. data/vendor/webrat/lib/webrat/selenium/matchers/have_tag.rb +72 -0
  128. data/vendor/webrat/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
  129. data/vendor/webrat/lib/webrat/selenium/selenium_extensions.js +6 -0
  130. data/vendor/webrat/lib/webrat/selenium/selenium_session.rb +247 -0
  131. data/vendor/webrat/lib/webrat/sinatra.rb +44 -0
  132. data/vendor/webrat/spec/fakes/test_session.rb +34 -0
  133. data/vendor/webrat/spec/integration/merb/Rakefile +35 -0
  134. data/vendor/webrat/spec/integration/merb/app/controllers/application.rb +2 -0
  135. data/vendor/webrat/spec/integration/merb/app/controllers/exceptions.rb +13 -0
  136. data/vendor/webrat/spec/integration/merb/app/controllers/testing.rb +18 -0
  137. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
  138. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
  139. data/vendor/webrat/spec/integration/merb/app/views/layout/application.html.erb +12 -0
  140. data/vendor/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
  141. data/vendor/webrat/spec/integration/merb/config/environments/development.rb +15 -0
  142. data/vendor/webrat/spec/integration/merb/config/environments/rake.rb +11 -0
  143. data/vendor/webrat/spec/integration/merb/config/environments/test.rb +14 -0
  144. data/vendor/webrat/spec/integration/merb/config/init.rb +25 -0
  145. data/vendor/webrat/spec/integration/merb/config/rack.rb +11 -0
  146. data/vendor/webrat/spec/integration/merb/config/router.rb +33 -0
  147. data/vendor/webrat/spec/integration/merb/spec/spec.opts +1 -0
  148. data/vendor/webrat/spec/integration/merb/spec/spec_helper.rb +24 -0
  149. data/vendor/webrat/spec/integration/merb/spec/webrat_spec.rb +32 -0
  150. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +31 -0
  151. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/common.rb +64 -0
  152. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +124 -0
  153. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
  154. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +93 -0
  155. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +40 -0
  156. data/vendor/webrat/spec/integration/rails/Rakefile +30 -0
  157. data/vendor/webrat/spec/integration/rails/app/controllers/application.rb +15 -0
  158. data/vendor/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +39 -0
  159. data/vendor/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
  160. data/vendor/webrat/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
  161. data/vendor/webrat/spec/integration/rails/config/boot.rb +109 -0
  162. data/vendor/webrat/spec/integration/rails/config/environment.rb +12 -0
  163. data/vendor/webrat/spec/integration/rails/config/environments/development.rb +17 -0
  164. data/vendor/webrat/spec/integration/rails/config/environments/selenium.rb +22 -0
  165. data/vendor/webrat/spec/integration/rails/config/environments/test.rb +22 -0
  166. data/vendor/webrat/spec/integration/rails/config/initializers/inflections.rb +10 -0
  167. data/vendor/webrat/spec/integration/rails/config/initializers/mime_types.rb +5 -0
  168. data/vendor/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +17 -0
  169. data/vendor/webrat/spec/integration/rails/config/locales/en.yml +5 -0
  170. data/vendor/webrat/spec/integration/rails/config/routes.rb +14 -0
  171. data/vendor/webrat/spec/integration/rails/public/404.html +30 -0
  172. data/vendor/webrat/spec/integration/rails/public/422.html +30 -0
  173. data/vendor/webrat/spec/integration/rails/public/500.html +33 -0
  174. data/vendor/webrat/spec/integration/rails/script/about +4 -0
  175. data/vendor/webrat/spec/integration/rails/script/console +3 -0
  176. data/vendor/webrat/spec/integration/rails/script/dbconsole +3 -0
  177. data/vendor/webrat/spec/integration/rails/script/destroy +3 -0
  178. data/vendor/webrat/spec/integration/rails/script/generate +3 -0
  179. data/vendor/webrat/spec/integration/rails/script/performance/benchmarker +3 -0
  180. data/vendor/webrat/spec/integration/rails/script/performance/profiler +3 -0
  181. data/vendor/webrat/spec/integration/rails/script/performance/request +3 -0
  182. data/vendor/webrat/spec/integration/rails/script/plugin +3 -0
  183. data/vendor/webrat/spec/integration/rails/script/process/inspector +3 -0
  184. data/vendor/webrat/spec/integration/rails/script/process/reaper +3 -0
  185. data/vendor/webrat/spec/integration/rails/script/process/spawner +3 -0
  186. data/vendor/webrat/spec/integration/rails/script/runner +3 -0
  187. data/vendor/webrat/spec/integration/rails/script/server +3 -0
  188. data/vendor/webrat/spec/integration/rails/test/integration/webrat_test.rb +80 -0
  189. data/vendor/webrat/spec/integration/rails/test/test_helper.rb +25 -0
  190. data/vendor/webrat/spec/integration/sinatra/Rakefile +5 -0
  191. data/vendor/webrat/spec/integration/sinatra/classic_app.rb +64 -0
  192. data/vendor/webrat/spec/integration/sinatra/modular_app.rb +16 -0
  193. data/vendor/webrat/spec/integration/sinatra/test/classic_app_test.rb +37 -0
  194. data/vendor/webrat/spec/integration/sinatra/test/modular_app_test.rb +18 -0
  195. data/vendor/webrat/spec/integration/sinatra/test/test_helper.rb +16 -0
  196. data/vendor/webrat/spec/private/core/configuration_spec.rb +104 -0
  197. data/vendor/webrat/spec/private/core/field_spec.rb +67 -0
  198. data/vendor/webrat/spec/private/core/link_spec.rb +24 -0
  199. data/vendor/webrat/spec/private/core/logging_spec.rb +10 -0
  200. data/vendor/webrat/spec/private/core/session_spec.rb +198 -0
  201. data/vendor/webrat/spec/private/mechanize/mechanize_session_spec.rb +81 -0
  202. data/vendor/webrat/spec/private/merb/merb_session_spec.rb +42 -0
  203. data/vendor/webrat/spec/private/nokogiri_spec.rb +77 -0
  204. data/vendor/webrat/spec/private/rails/attaches_file_spec.rb +81 -0
  205. data/vendor/webrat/spec/private/rails/rails_session_spec.rb +110 -0
  206. data/vendor/webrat/spec/private/selenium/selenium_session_spec.rb +44 -0
  207. data/vendor/webrat/spec/private/selenium/selenium_spec.rb +109 -0
  208. data/vendor/webrat/spec/public/basic_auth_spec.rb +24 -0
  209. data/vendor/webrat/spec/public/check_spec.rb +191 -0
  210. data/vendor/webrat/spec/public/choose_spec.rb +118 -0
  211. data/vendor/webrat/spec/public/click_area_spec.rb +106 -0
  212. data/vendor/webrat/spec/public/click_button_spec.rb +502 -0
  213. data/vendor/webrat/spec/public/click_link_spec.rb +469 -0
  214. data/vendor/webrat/spec/public/fill_in_spec.rb +209 -0
  215. data/vendor/webrat/spec/public/locators/field_by_xpath_spec.rb +19 -0
  216. data/vendor/webrat/spec/public/locators/field_labeled_spec.rb +157 -0
  217. data/vendor/webrat/spec/public/locators/field_with_id_spec.rb +16 -0
  218. data/vendor/webrat/spec/public/matchers/contain_spec.rb +114 -0
  219. data/vendor/webrat/spec/public/matchers/have_selector_spec.rb +135 -0
  220. data/vendor/webrat/spec/public/matchers/have_tag_spec.rb +39 -0
  221. data/vendor/webrat/spec/public/matchers/have_xpath_spec.rb +123 -0
  222. data/vendor/webrat/spec/public/reload_spec.rb +10 -0
  223. data/vendor/webrat/spec/public/save_and_open_spec.rb +51 -0
  224. data/vendor/webrat/spec/public/select_date_spec.rb +88 -0
  225. data/vendor/webrat/spec/public/select_datetime_spec.rb +106 -0
  226. data/vendor/webrat/spec/public/select_spec.rb +246 -0
  227. data/vendor/webrat/spec/public/select_time_spec.rb +79 -0
  228. data/vendor/webrat/spec/public/set_hidden_field_spec.rb +5 -0
  229. data/vendor/webrat/spec/public/submit_form_spec.rb +5 -0
  230. data/vendor/webrat/spec/public/visit_spec.rb +58 -0
  231. data/vendor/webrat/spec/public/within_spec.rb +177 -0
  232. data/vendor/webrat/spec/rcov.opts +1 -0
  233. data/vendor/webrat/spec/spec.opts +2 -0
  234. data/vendor/webrat/spec/spec_helper.rb +50 -0
  235. data/vendor/webrat/vendor/selenium-server.jar +0 -0
  236. data/views/_commit_info.haml +24 -0
  237. data/views/build.haml +2 -2
  238. data/views/error.haml +4 -3
  239. data/views/home.haml +3 -5
  240. data/views/integrity.sass +19 -6
  241. data/views/new.haml +6 -6
  242. data/views/project.builder +9 -9
  243. data/views/project.haml +14 -12
  244. metadata +319 -124
  245. data/app.rb +0 -138
  246. data/integrity.gemspec +0 -76
  247. data/lib/integrity/core_ext/string.rb +0 -5
  248. data/test/helpers/expectations/have_tag.rb +0 -128
  249. data/views/_build_info.haml +0 -18
@@ -0,0 +1,177 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe "within" do
4
+ it "should work when nested" do
5
+ with_html <<-HTML
6
+ <html>
7
+ <div>
8
+ <a href="/page1">Link</a>
9
+ </div>
10
+ <div id="container">
11
+ <div><a href="/page2">Link</a></div>
12
+ </div>
13
+ </html>
14
+ HTML
15
+
16
+ webrat_session.should_receive(:get).with("/page2", {})
17
+ within "#container" do
18
+ within "div" do
19
+ click_link "Link"
20
+ end
21
+ end
22
+ end
23
+
24
+ it "should click links within a scope" do
25
+ with_html <<-HTML
26
+ <html>
27
+ <a href="/page1">Link</a>
28
+ <div id="container">
29
+ <a href="/page2">Link</a>
30
+ </div>
31
+ </html>
32
+ HTML
33
+
34
+ webrat_session.should_receive(:get).with("/page2", {})
35
+ within "#container" do
36
+ click_link "Link"
37
+ end
38
+ end
39
+
40
+ it "should submit forms within a scope" do
41
+ with_html <<-HTML
42
+ <html>
43
+ <form id="form1" action="/form1">
44
+ <label>Email: <input type="text" name="email" />
45
+ <input type="submit" value="Add" />
46
+ </form>
47
+ <form id="form2" action="/form2">
48
+ <label>Email: <input type="text" name="email" />
49
+ <input type="submit" value="Add" />
50
+ </form>
51
+ </html>
52
+ HTML
53
+
54
+ webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com")
55
+ within "#form2" do
56
+ fill_in "Email", :with => "test@example.com"
57
+ click_button
58
+ end
59
+ end
60
+
61
+ it "should work when the scope is inside the form" do
62
+ with_html <<-HTML
63
+ <html>
64
+ <form id="form2" action="/form2">
65
+ <div class="important">
66
+ <label>Email: <input type="text" class="email2" name="email" /></label>
67
+ </div>
68
+ <input type="submit" value="Add" />
69
+ </form>
70
+ </html>
71
+ HTML
72
+
73
+ webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com")
74
+ within ".important" do
75
+ fill_in "Email", :with => "test@example.com"
76
+ end
77
+
78
+ submit_form "form2"
79
+ end
80
+
81
+ it "should work when the form submission occurs inside a scope" do
82
+ with_html <<-HTML
83
+ <html>
84
+ <body>
85
+ <div>
86
+ <form id="form2" action="/form2">
87
+ <label for="email">Email</label><input id="email" type="text" class="email2" name="email" />
88
+ <input type="submit" value="Add" />
89
+ </form>
90
+ </div>
91
+ </body>
92
+ </html>
93
+ HTML
94
+
95
+ webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com")
96
+ within "form[@action='/form2']" do
97
+ fill_in "Email", :with => "test@example.com"
98
+ click_button "Add"
99
+ end
100
+ end
101
+
102
+ it "should work when there are multiple forms with the same label text" do
103
+ with_html <<-HTML
104
+ <html>
105
+ <body>
106
+ <div>
107
+ <form id="form1" action="/form1">
108
+ <label for="email1">Email</label><input id="email1" type="text" class="email1" name="email1" />
109
+ <input type="submit" value="Add" />
110
+ </form>
111
+ <form id="form2" action="/form2">
112
+ <label for="email2">Email</label><input id="email2" type="text" class="email2" name="email2" />
113
+ <input type="submit" value="Add" />
114
+ </form>
115
+ </div>
116
+ </body>
117
+ </html>
118
+ HTML
119
+
120
+ webrat_session.should_receive(:get).with("/form2", "email2" => "test@example.com")
121
+ within "form[@action='/form2']" do
122
+ fill_in "Email", :with => "test@example.com"
123
+ click_button "Add"
124
+ end
125
+ end
126
+
127
+ it "should not find fields outside of the scope" do
128
+ with_html <<-HTML
129
+ <html>
130
+ <form id="form1" action="/form1">
131
+ <label for="email">Email</label><input id="email" type="text" name="email" />
132
+ <input type="submit" value="Add" />
133
+ </form>
134
+ <form id="form2" action="/form2">
135
+ <label for="email">Email</label><input id="email" type="text" name="email" />
136
+ <input type="submit" value="Add" />
137
+ </form>
138
+ </html>
139
+ HTML
140
+
141
+ webrat_session.should_receive(:get).with("/form2", "email" => "test@example.com")
142
+ within "#form2" do
143
+ fill_in "Email", :with => "test@example.com"
144
+ click_button "Add"
145
+ end
146
+ end
147
+
148
+ it "should not find buttons outside of the scope" do
149
+ with_html <<-HTML
150
+ <html>
151
+ <form action="/form1">
152
+ <input type="submit" value="Add" />
153
+ </form>
154
+ <form id="form2" action="/form2">
155
+ </form>
156
+ </html>
157
+ HTML
158
+
159
+ within "#form2" do
160
+ lambda {
161
+ click_button
162
+ }.should raise_error(Webrat::NotFoundError)
163
+ end
164
+ end
165
+
166
+ it "should raise a Webrat::NotFounderror error when the scope doesn't exist" do
167
+ with_html <<-HTML
168
+ <html>
169
+ </html>
170
+ HTML
171
+
172
+ lambda {
173
+ within "#form2" do
174
+ end
175
+ }.should raise_error(Webrat::NotFoundError)
176
+ end
177
+ end
@@ -0,0 +1 @@
1
+ -x gems,spec
@@ -0,0 +1,2 @@
1
+ --diff
2
+ --color
@@ -0,0 +1,50 @@
1
+ require "rubygems"
2
+ require "test/unit"
3
+ require "spec"
4
+
5
+ # gem install redgreen for colored test output
6
+ begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
7
+
8
+ webrat_path = File.expand_path(File.dirname(__FILE__) + "/../lib/")
9
+ $LOAD_PATH.unshift(webrat_path) unless $LOAD_PATH.include?(webrat_path)
10
+
11
+ require "webrat"
12
+ require File.expand_path(File.dirname(__FILE__) + "/fakes/test_session")
13
+
14
+ module Webrat
15
+ @@previous_config = nil
16
+
17
+ def self.cache_config_for_test
18
+ @@previous_config = Webrat.configuration.clone
19
+ end
20
+
21
+ def self.reset_for_test
22
+ @@configuration = @@previous_config if @@previous_config
23
+ end
24
+ end
25
+
26
+ Spec::Runner.configure do |config|
27
+ include Webrat::Methods
28
+
29
+ def with_html(html)
30
+ raise "This doesn't look like HTML. Wrap it in a <html> tag" unless html =~ /^\s*<[^Hh>]*html/i
31
+ webrat_session.response_body = html
32
+ end
33
+
34
+ def with_xml(xml)
35
+ raise "This looks like HTML" if xml =~ /^\s*<[^Hh>]*html/i
36
+ webrat_session.response_body = xml
37
+ end
38
+
39
+ config.before :each do
40
+ Webrat.cache_config_for_test
41
+ end
42
+
43
+ config.after :each do
44
+ Webrat.reset_for_test
45
+ end
46
+ end
47
+
48
+ Webrat.configure do |config|
49
+ config.mode = :merb
50
+ end
@@ -0,0 +1,24 @@
1
+ %h1&= commit.human_readable_status
2
+
3
+ - if commit.failed?
4
+ %form{ :action => commit_path(commit, :builds), :method => :post }
5
+ %p.submit
6
+ %button{ :type => :submit, :title => "Rebuild this commit" }<
7
+ Rebuild
8
+
9
+ %blockquote
10
+ %p&= commit.message
11
+ %p.meta<
12
+ %span.who<
13
+ &== by: #{commit.author.name}
14
+ |
15
+ %span.when{ :title => commit.commited_at }<
16
+ &= pretty_date commit.committed_at
17
+ |
18
+ %span.what<
19
+ &== commit: #{commit.identifier}
20
+
21
+ %h2 Build Output:
22
+ %pre.output
23
+ :preserve
24
+ #{bash_color_codes h(commit.output)}
@@ -1,2 +1,2 @@
1
- #build{ :class => @build.status }
2
- = partial(:build_info, :build => @build)
1
+ #build{ :class => @commit.status }
2
+ = partial(:commit_info, :commit => @commit)
@@ -13,9 +13,10 @@
13
13
 
14
14
  %dt What can I do?
15
15
  %dd
16
- Is your
17
- %a{ :href => project_url(@project, :edit) } config
18
- ok?
16
+ - if @project
17
+ Is your
18
+ %a{ :href => project_url(@project, :edit) } config
19
+ ok?
19
20
  Need
20
21
  %a{ :href => "http://integrityapp.com/configure" } help?
21
22
  Remember to restart Integrity.
@@ -8,16 +8,14 @@
8
8
  - else
9
9
  %ul#projects
10
10
  - @projects.each do |project|
11
- %li{ :class => cycle("even", "odd") + (project.building? ? ' building' : '') + (project.last_build ? (project.last_build.successful? ? ' success' : ' failed') : '') }
11
+ %li{ :class => cycle("even", "odd") + ' ' + project.status.to_s }
12
12
  %a{ :href => project_path(project) }&= project.name
13
13
  .meta
14
14
  - if project.building?
15
15
  Building!
16
- - elsif project.last_build.nil?
16
+ - elsif project.last_commit.nil?
17
17
  Never built yet
18
18
  - else
19
- == Built #{project.last_build.short_commit_identifier}
20
- = pretty_date(project.last_build.created_at)
21
- = project.last_build.successful? ? "successfully" : "and failed"
19
+ = project.human_readable_status
22
20
  %p#new
23
21
  %a{ :href => "/new" } Add a new project
@@ -108,6 +108,7 @@ a
108
108
  :width 30em
109
109
  :padding .2em .4em
110
110
  :color = !title_color
111
+ input.text
111
112
  :height 1.4em
112
113
  label
113
114
  :float left
@@ -177,11 +178,22 @@ a
177
178
  :content "."
178
179
  :text-indent -9999em
179
180
  :text-align left
180
- &.destroy
181
- :margin-top 0
181
+ &.destroy, &.manual-build
182
182
  button
183
183
  :float none
184
184
  :display inline
185
+ &.manual-build
186
+ button
187
+ :margin-right 0
188
+
189
+ #build form, #last_build form
190
+ :font-size .75em
191
+ p.submit
192
+ :margin 0
193
+ :padding 0
194
+ :position absolute
195
+ :right .5em
196
+ :top 1.25em
185
197
 
186
198
  .blank_slate, .error
187
199
  p
@@ -213,7 +225,7 @@ a
213
225
  :family = !nice_fonts
214
226
  dd
215
227
  :line-height 1.4
216
-
228
+
217
229
  .backtrace
218
230
  :margin 1em 0
219
231
  :overflow scroll
@@ -254,8 +266,8 @@ a
254
266
  :color = !success_color
255
267
  &.failed .meta
256
268
  :color = !failed_color
257
-
258
-
269
+
270
+
259
271
  #previous_builds
260
272
  li
261
273
  a
@@ -288,9 +300,10 @@ a
288
300
  :color = !failed_bg - #444
289
301
  &:hover
290
302
  :background-color = !failed_bg + #222
291
-
303
+
292
304
 
293
305
  #build, #last_build
306
+ :position relative
294
307
  h1, blockquote
295
308
  :border
296
309
  :width 0 1px
@@ -7,29 +7,29 @@
7
7
  %label{ :for => "project_name" }<
8
8
  &== Name #{errors_on @project, :name}
9
9
  %input.text#project_name{ :name => "project_data[name]", :type => "text", :value => h(@project.name) }
10
-
10
+
11
11
  %p.required{ :class => error_class(@project, :uri) }
12
12
  %label{ :for => "project_repository" }<
13
13
  &== Git repository #{errors_on @project, :uri}
14
14
  %input.text#project_repository{ :name => "project_data[uri]", :type => "text", :value => h(@project.uri) }
15
-
15
+
16
16
  %p.normal{ :class => error_class(@project, :branch) }
17
17
  %label{ :for => "project_branch" }<
18
18
  &== Branch to track #{errors_on @project, :branch}
19
19
  %input.text#project_branch{ :name => "project_data[branch]", :type => "text", :value => "master", :value => h(@project.branch) }
20
-
20
+
21
21
  %p.normal{ :class => error_class(@project, :command) }
22
22
  %label{ :for => "project_build_script" }
23
23
  &== Build script #{errors_on @project, :command}
24
- %textarea#project_build_script{ :name => "project_data[command]", :cols => 40, :rows => 1 }
24
+ %textarea#project_build_script{ :name => "project_data[command]", :cols => 40, :rows => 2 }
25
25
  &== #{@project.command.to_s}
26
26
 
27
27
  %p.normal.checkbox
28
28
  %label{ :for => "project_public" } Public project
29
29
  %input.hidden{ :name => "project_data[public]", :value => "0", :type => "hidden" }
30
30
  %input.checkbox#project_public{ checkbox("project_data[public]", @project.public?) }
31
-
32
- - Notifier.available.each do |notifier|
31
+
32
+ - Integrity::Notifier.available.each do |notifier|
33
33
  = notifier_form(notifier)
34
34
 
35
35
  %p.submit
@@ -2,20 +2,20 @@ xml.instruct!
2
2
  xml.feed :xmlns => "http://www.w3.org/2005/Atom" do
3
3
  xml.title "Build history for #{@project.name}"
4
4
  xml.subtitle @project.uri
5
- xml.updated @project.builds.first.created_at
5
+ xml.updated @project.last_commit.updated_at
6
6
  xml.link :href => "#{project_url(@project)}.atom", :rel => "self"
7
7
  xml.id "#{project_url(@project)}.atom"
8
8
 
9
- @project.builds.each do |build|
9
+ @project.commits.each do |commit|
10
10
  xml.entry do
11
- xml.id build_url(build)
12
- xml.link :href => build_url(build), :rel => "alternate", :type => "text/html"
13
- xml.updated build.created_at
14
- xml.published build.created_at
11
+ xml.id commit_url(commit)
12
+ xml.link :href => commit_url(commit), :rel => "alternate", :type => "text/html"
13
+ xml.updated commit.created_at
14
+ xml.published commit.created_at
15
15
 
16
- xml.title "Built #{build.short_commit_identifier} #{build.successful? ? "successfully" : "and failed"}"
17
- xml.author { xml.name(build.commit_author.name) }
18
- xml.content("<div>#{partial(:build_info, :build => build)}</div>", :type => "html")
16
+ xml.title commit.human_readable_status
17
+ xml.author { xml.name(commit.author.name) }
18
+ xml.content("<div>#{partial(:commit_info, :commit => commit)}</div>", :type => "html")
19
19
  end
20
20
  end
21
21
  end
@@ -1,28 +1,30 @@
1
1
  #administrative
2
2
  %a{ :href => project_path(@project, :edit) } Edit Project
3
3
 
4
- - if @project.builds.empty?
4
+ - if @project.commits.empty?
5
5
  %form.blank_slate{ :action => project_path(@project, :builds), :method => :post }
6
6
  %p No builds for this project, buddy
7
7
  %h1
8
8
  You can request a
9
9
  %button{ :type => :submit } manual build
10
10
  - else
11
- - @build = @project.last_build
12
- #last_build{ :class => @build.status }
13
- = partial(:build_info, :build => @build)
11
+ - @commit = @project.last_commit
12
+ #last_build{ :class => @commit.status }
13
+ = partial(:commit_info, :commit => @commit)
14
14
 
15
15
  %form{ :action => project_path(@project, :builds), :method => :post }
16
- %p.submit
17
- %button{ :type => :submit } Request Manual Build
16
+ %p.submit.manual-build
17
+ %button{ :type => :submit, :title => "Fetch the last commit and build it" }<
18
+ Build the last commit
19
+ in the repository (or rebuild the latest)
18
20
 
19
- - unless @project.previous_builds.empty?
21
+ - unless @project.previous_commits.empty?
20
22
  %h2 Previous builds
21
23
  %ul#previous_builds
22
- - @project.previous_builds.each do |build|
23
- %li{ :class => build.status }
24
- %a{ :href => build_path(build) }
24
+ - @project.previous_commits.each do |commit|
25
+ %li{ :class => commit.status }
26
+ %a{ :href => commit_path(commit) }
25
27
  %strong.build<
26
- &== Build #{build.short_commit_identifier}
28
+ &== Build #{commit.short_identifier}
27
29
  %span.attribution<
28
- == by #{build.commit_author.name}, #{pretty_date build.commited_at}
30
+ == by #{commit.author.name}, #{pretty_date commit.committed_at}