atrium 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. data/.gitignore +13 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +32 -0
  4. data/GETTING_STARTED.textile +109 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +320 -0
  7. data/Guardfile +10 -0
  8. data/README.mkd +56 -0
  9. data/Rakefile +6 -0
  10. data/app/assets/images/atrium/ajax-loader.gif +0 -0
  11. data/app/assets/images/atrium/lightbox-ico-loading.gif +0 -0
  12. data/app/assets/images/atrium/logo.png +0 -0
  13. data/app/assets/javascripts/atrium/atrium.js +281 -0
  14. data/app/assets/javascripts/chosen.jquery.js +899 -0
  15. data/app/assets/javascripts/ckeditor.warning.js +65 -0
  16. data/app/assets/javascripts/ckeditor/config.js.coffee +6 -0
  17. data/app/assets/javascripts/ckeditor/jquery.generateId.js +13 -0
  18. data/app/assets/javascripts/ckeditor/jquery.jeditable.ckeditor.js +59 -0
  19. data/app/assets/javascripts/ckeditor/plugins/linkItem/application_link.png +0 -0
  20. data/app/assets/javascripts/ckeditor/plugins/linkItem/dialogs/linkItem.js +1470 -0
  21. data/app/assets/javascripts/ckeditor/plugins/linkItem/plugin.js +16 -0
  22. data/app/assets/javascripts/ckeditor/plugins/linkItem/ui_toolbar_pencil.png +0 -0
  23. data/app/assets/javascripts/jquery.colorbox.js +864 -0
  24. data/app/assets/javascripts/jquery.jeditable.js +543 -0
  25. data/app/assets/stylesheets/atrium/atrium.css +216 -0
  26. data/app/assets/stylesheets/atrium/chosen-sprite.png +0 -0
  27. data/app/assets/stylesheets/atrium/chosen.css +367 -0
  28. data/app/assets/stylesheets/colorbox.css +42 -0
  29. data/app/assets/stylesheets/controls.png +0 -0
  30. data/app/assets/stylesheets/loading.gif +0 -0
  31. data/app/controllers/atrium/base_controller.rb +25 -0
  32. data/app/controllers/atrium/collection_exhibit_order_controller.rb +21 -0
  33. data/app/controllers/atrium/collections_controller.rb +165 -0
  34. data/app/controllers/atrium/customization_controller.rb +41 -0
  35. data/app/controllers/atrium/descriptions_controller.rb +177 -0
  36. data/app/controllers/atrium/exhibit_facet_order_controller.rb +19 -0
  37. data/app/controllers/atrium/exhibits_controller.rb +108 -0
  38. data/app/controllers/atrium/showcases_controller.rb +193 -0
  39. data/app/helpers/atrium/base_helper.rb +6 -0
  40. data/app/models/ability.rb +14 -0
  41. data/app/models/atrium/browse_level.rb +41 -0
  42. data/app/models/atrium/collection.rb +121 -0
  43. data/app/models/atrium/description.rb +128 -0
  44. data/app/models/atrium/essay.rb +21 -0
  45. data/app/models/atrium/exhibit.rb +58 -0
  46. data/app/models/atrium/search/facet.rb +29 -0
  47. data/app/models/atrium/search/facet_selection.rb +17 -0
  48. data/app/models/atrium/showcase.rb +173 -0
  49. data/app/models/atrium/showcase/facet_selection.rb +21 -0
  50. data/app/models/atrium/showcase/item.rb +19 -0
  51. data/app/models/role_mapper.rb +23 -0
  52. data/app/views/_user_util_links.html.erb +25 -0
  53. data/app/views/atrium/collections/_bookmark_control.html.erb +25 -0
  54. data/app/views/atrium/collections/_browse_index.html.erb +20 -0
  55. data/app/views/atrium/collections/_collection_items_index.html.erb +10 -0
  56. data/app/views/atrium/collections/_document.html.erb +24 -0
  57. data/app/views/atrium/collections/_document_list.html.erb +6 -0
  58. data/app/views/atrium/collections/_edit_navigation.html.erb +20 -0
  59. data/app/views/atrium/collections/_folder_control.html.erb +12 -0
  60. data/app/views/atrium/collections/_form.html.erb +93 -0
  61. data/app/views/atrium/collections/_listing.html.erb +18 -0
  62. data/app/views/atrium/collections/_navigation.html.erb +45 -0
  63. data/app/views/atrium/collections/_results_pagination.html.erb +9 -0
  64. data/app/views/atrium/collections/_sort_and_per_page.html.erb +23 -0
  65. data/app/views/atrium/collections/edit.html.erb +5 -0
  66. data/app/views/atrium/collections/new.html.erb +6 -0
  67. data/app/views/atrium/collections/show.html.erb +22 -0
  68. data/app/views/atrium/descriptions/_form.html.erb +64 -0
  69. data/app/views/atrium/descriptions/edit.html.erb +4 -0
  70. data/app/views/atrium/descriptions/index.html.erb +4 -0
  71. data/app/views/atrium/descriptions/new.html.erb +2 -0
  72. data/app/views/atrium/descriptions/show.html.erb +20 -0
  73. data/app/views/atrium/exhibits/_bookmark_control.html.erb +25 -0
  74. data/app/views/atrium/exhibits/_folder_control.html.erb +12 -0
  75. data/app/views/atrium/exhibits/_form.html.erb +108 -0
  76. data/app/views/atrium/exhibits/edit.html.erb +9 -0
  77. data/app/views/atrium/exhibits/new.html.erb +6 -0
  78. data/app/views/atrium/exhibits/show.html.erb +26 -0
  79. data/app/views/atrium/showcases/_showcase_navigation.html.erb +23 -0
  80. data/app/views/atrium/showcases/show.html.erb +1 -0
  81. data/app/views/catalog/_collection_home_text.html.erb +6 -0
  82. data/app/views/catalog/_constraints.html.erb +9 -0
  83. data/app/views/catalog/_default_collection_text.html.erb +18 -0
  84. data/app/views/catalog/_default_home_text.html.erb +6 -0
  85. data/app/views/catalog/_home_text.html.erb +6 -0
  86. data/app/views/catalog/_index_partials/_description.html.erb +8 -0
  87. data/app/views/catalog/_search_form.html.erb +66 -0
  88. data/app/views/catalog/_show_partials/_description.html.erb +15 -0
  89. data/app/views/catalog/browse_show.html.erb +18 -0
  90. data/app/views/catalog/index.html.erb +35 -0
  91. data/app/views/catalog/list_description.html.erb +24 -0
  92. data/app/views/catalog/list_item.html.erb +3 -0
  93. data/app/views/layouts/atrium.html.erb +86 -0
  94. data/app/views/layouts/atrium_themes/default.html.erb +4 -0
  95. data/app/views/layouts/item_listing.html.erb +36 -0
  96. data/app/views/listing/_document.html.erb +27 -0
  97. data/app/views/listing/_document_list.html.erb +3 -0
  98. data/app/views/listing/_item_search.html.erb +27 -0
  99. data/app/views/shared/_banner.html.erb +5 -0
  100. data/app/views/shared/_collection_complete_list.html.erb +33 -0
  101. data/app/views/shared/_collection_search_form.html.erb +12 -0
  102. data/app/views/shared/_collection_title_header.html.erb +3 -0
  103. data/app/views/shared/_featured_sources.html.erb +20 -0
  104. data/app/views/shared/_list_descriptions.html.erb +38 -0
  105. data/app/views/shared/_navigation_browse_levels.html.erb +34 -0
  106. data/app/views/shared/_showcase_configure_menu.html.erb +22 -0
  107. data/app/views/shared/_top_navigation.html.erb +9 -0
  108. data/atrium.gemspec +76 -0
  109. data/config/routes.rb +12 -0
  110. data/init.rb +3 -0
  111. data/lib/application_controller.rb +24 -0
  112. data/lib/atrium.rb +42 -0
  113. data/lib/atrium/application_helper.rb +24 -0
  114. data/lib/atrium/atrium_helper_behavior.rb +162 -0
  115. data/lib/atrium/catalog.rb +203 -0
  116. data/lib/atrium/collections_helper.rb +139 -0
  117. data/lib/atrium/controller.rb +10 -0
  118. data/lib/atrium/descriptions_helper.rb +23 -0
  119. data/lib/atrium/engine.rb +12 -0
  120. data/lib/atrium/layout_helper.rb +13 -0
  121. data/lib/atrium/routes.rb +99 -0
  122. data/lib/atrium/solr_helper.rb +440 -0
  123. data/lib/atrium/version.rb +3 -0
  124. data/lib/generators/atrium/assets_generator.rb +44 -0
  125. data/lib/generators/atrium/atrium_generator.rb +149 -0
  126. data/lib/generators/atrium/cucumber_support_generator.rb +29 -0
  127. data/lib/generators/atrium/templates/config/role_map_cucumber.yml +2 -0
  128. data/lib/generators/atrium/templates/config/role_map_development.yml +2 -0
  129. data/lib/generators/atrium/templates/config/role_map_production.yml +2 -0
  130. data/lib/generators/atrium/templates/config/role_map_test.yml +2 -0
  131. data/lib/generators/atrium/templates/config/solr.yml +10 -0
  132. data/lib/generators/atrium/templates/db/seeds.rb +87 -0
  133. data/lib/generators/atrium/templates/migrations/create_atrium_browse_levels.rb +18 -0
  134. data/lib/generators/atrium/templates/migrations/create_atrium_collections.rb +20 -0
  135. data/lib/generators/atrium/templates/migrations/create_atrium_descriptions.rb +16 -0
  136. data/lib/generators/atrium/templates/migrations/create_atrium_essays.rb +15 -0
  137. data/lib/generators/atrium/templates/migrations/create_atrium_exhibits.rb +16 -0
  138. data/lib/generators/atrium/templates/migrations/create_atrium_search_facets.rb +14 -0
  139. data/lib/generators/atrium/templates/migrations/create_atrium_showcase_facet_selections.rb +15 -0
  140. data/lib/generators/atrium/templates/migrations/create_atrium_showcase_items.rb +17 -0
  141. data/lib/generators/atrium/templates/migrations/create_atrium_showcases.rb +16 -0
  142. data/lib/generators/atrium/templates/themes/example.html.erb +21 -0
  143. data/lib/railties/all_tests.rake +23 -0
  144. data/lib/railties/atrium_cucumber.rake +121 -0
  145. data/lib/railties/index.rake +37 -0
  146. data/tasks/atrium.rake +268 -0
  147. data/tasks/atrium_rspec.rake +91 -0
  148. data/test_support/etc/Gemfile +33 -0
  149. data/test_support/etc/bundle_config +3 -0
  150. data/test_support/etc/rvmrc +32 -0
  151. data/test_support/features/atrium_collections.feature +162 -0
  152. data/test_support/features/atrium_exhibits.feature +164 -0
  153. data/test_support/features/step_definitions/atrium_collection_steps.rb +102 -0
  154. data/test_support/features/step_definitions/atrium_exhibit_steps.rb +53 -0
  155. data/test_support/features/step_definitions/bookmarks_steps.rb +6 -0
  156. data/test_support/features/step_definitions/error_steps.rb +5 -0
  157. data/test_support/features/step_definitions/folder_steps.rb +27 -0
  158. data/test_support/features/step_definitions/general_steps.rb +50 -0
  159. data/test_support/features/step_definitions/record_view_steps.rb +12 -0
  160. data/test_support/features/step_definitions/saved_searches_steps.rb +22 -0
  161. data/test_support/features/step_definitions/search_facets_steps.rb +29 -0
  162. data/test_support/features/step_definitions/search_history_steps.rb +9 -0
  163. data/test_support/features/step_definitions/search_result_steps.rb +114 -0
  164. data/test_support/features/step_definitions/search_steps.rb +103 -0
  165. data/test_support/features/step_definitions/user_steps.rb +5 -0
  166. data/test_support/features/step_definitions/web_steps.rb +213 -0
  167. data/test_support/features/support/env.rb +67 -0
  168. data/test_support/features/support/paths.rb +76 -0
  169. data/test_support/features/support/selectors.rb +40 -0
  170. data/test_support/fixtures/atrium_exhibits.yml +3 -0
  171. data/test_support/spec/controllers/atrium/base_controller_spec.rb +13 -0
  172. data/test_support/spec/controllers/atrium/collection_exhibit_order_controller_spec.rb +29 -0
  173. data/test_support/spec/controllers/atrium/collections_controller_spec.rb +185 -0
  174. data/test_support/spec/controllers/atrium/customization_controller_spec.rb +38 -0
  175. data/test_support/spec/controllers/atrium/descriptions_controller_spec.rb +150 -0
  176. data/test_support/spec/controllers/atrium/exhibit_facet_order_controller_spec.rb +36 -0
  177. data/test_support/spec/controllers/atrium/exhibits_controller_spec.rb +192 -0
  178. data/test_support/spec/controllers/atrium/showcases_controller_spec.rb +185 -0
  179. data/test_support/spec/helpers/atrium_collections_helper_spec.rb +147 -0
  180. data/test_support/spec/helpers/atrium_description_helper_spec.rb +47 -0
  181. data/test_support/spec/helpers/atrium_solr_helper_spec.rb +512 -0
  182. data/test_support/spec/models/atrium/browse_level_spec.rb +31 -0
  183. data/test_support/spec/models/atrium/collection_spec.rb +30 -0
  184. data/test_support/spec/models/atrium/description_spec.rb +67 -0
  185. data/test_support/spec/models/atrium/essay_spec.rb +12 -0
  186. data/test_support/spec/models/atrium/exhibit_spec.rb +76 -0
  187. data/test_support/spec/models/atrium/search/facet_selection_spec.rb +24 -0
  188. data/test_support/spec/models/atrium/search/facet_spec.rb +11 -0
  189. data/test_support/spec/models/atrium/search_facet_spec.rb +54 -0
  190. data/test_support/spec/models/atrium/showcase/facet_selection_spec.rb +15 -0
  191. data/test_support/spec/models/atrium/showcase/item_spec.rb +12 -0
  192. data/test_support/spec/models/atrium/showcase_facet_selection_spec.rb +65 -0
  193. data/test_support/spec/models/atrium/showcase_spec.rb +134 -0
  194. data/test_support/spec/rcov.opts +3 -0
  195. data/test_support/spec/routing/atrium/collections_routing_spec.rb +33 -0
  196. data/test_support/spec/spec.opts +4 -0
  197. data/test_support/spec/spec_helper.rb +47 -0
  198. data/test_support/spec/support/be_accessible_matcher.rb +8 -0
  199. data/test_support/spec/support/be_routed_mixin.rb +7 -0
  200. data/test_support/tmp/step_definitions/catalog_index_steps.rb +14 -0
  201. data/test_support/tmp/step_definitions/edit_document_steps.rb +67 -0
  202. data/test_support/tmp/step_definitions/hydra_metadata_steps.rb +3 -0
  203. data/test_support/tmp/step_definitions/hydra_steps.rb +8 -0
  204. data/test_support/tmp/step_definitions/search_steps.rb +86 -0
  205. data/test_support/tmp/step_definitions/searching_steps.rb +22 -0
  206. data/test_support/tmp/step_definitions/select_steps.rb +8 -0
  207. data/test_support/tmp/step_definitions/show_document_steps.rb +73 -0
  208. data/test_support/tmp/step_definitions/user_steps.rb +15 -0
  209. data/test_support/tmp/step_definitions/web_steps.rb +273 -0
  210. data/test_support/tmp/support/env.rb +54 -0
  211. data/test_support/tmp/support/paths.rb +57 -0
  212. metadata +1047 -0
@@ -0,0 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Given /^user with login "([^\"]*)" and email "([^\"]*)" and password "([^\"]*)"$/ do |login, email, password|
3
+ user = User.create(:login => login, :email => email, :password => password, :password_confirmation => password)
4
+ User.find(user.id).should_not be_nil
5
+ end
@@ -0,0 +1,213 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # TL;DR: YOU SHOULD DELETE THIS FILE
3
+ #
4
+ # This file iwas generated by Cucumber-Rails and is only here to get you a head start
5
+ # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
6
+ # visit pages, interact with widgets and make assertions about page content.
7
+ #
8
+ # If you use these step definitions as basis for your features you will quickly end up
9
+ # with features that are:
10
+ #
11
+ # * Hard to maintain
12
+ # * Verbose to read
13
+ #
14
+ # A much better approach is to write your own higher level step definitions, following
15
+ # the advice in the following blog posts:
16
+ #
17
+ # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
18
+ # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
19
+ # * http://elabs.se/blog/15-you-re-cuking-it-wrong
20
+ #
21
+
22
+
23
+ require 'uri'
24
+ require 'cgi'
25
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
26
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
27
+
28
+ module WithinHelpers
29
+ def with_scope(locator)
30
+ locator ? within(*selector_for(locator)) { yield } : yield
31
+ end
32
+ end
33
+ World(WithinHelpers)
34
+
35
+ # Single-line step scoper
36
+ When /^(.*) within ([^:]+)$/ do |step, parent|
37
+ with_scope(parent) { When step }
38
+ end
39
+
40
+ # Multi-line step scoper
41
+ When /^(.*) within ([^:]+):$/ do |step, parent, table_or_string|
42
+ with_scope(parent) { When "#{step}:", table_or_string }
43
+ end
44
+
45
+ Given /^(?:|I )am on (.+)$/ do |page_name|
46
+ visit path_to(page_name)
47
+ end
48
+
49
+ When /^(?:|I )go to (.+)$/ do |page_name|
50
+ visit path_to(page_name)
51
+ end
52
+
53
+ When /^(?:|I )press "([^"]*)"$/ do |button|
54
+ #save_and_open_page
55
+ click_button(button)
56
+ end
57
+
58
+ When /^(?:|I )follow "([^"]*)"$/ do |link|
59
+ click_link(link)
60
+ end
61
+
62
+ When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
63
+ fill_in(field, :with => value)
64
+ end
65
+
66
+ When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
67
+ fill_in(field, :with => value)
68
+ end
69
+
70
+ # Use this to fill in an entire form with data from a table. Example:
71
+ #
72
+ # When I fill in the following:
73
+ # | Account Number | 5002 |
74
+ # | Expiry date | 2009-11-01 |
75
+ # | Note | Nice guy |
76
+ # | Wants Email? | |
77
+ #
78
+ # TODO: Add support for checkbox, select og option
79
+ # based on naming conventions.
80
+ #
81
+ When /^(?:|I )fill in the following:$/ do |fields|
82
+ fields.rows_hash.each do |name, value|
83
+ When %{I fill in "#{name}" with "#{value}"}
84
+ end
85
+ end
86
+
87
+ When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
88
+ select(value, :from => field)
89
+ end
90
+
91
+ When /^(?:|I )check "([^"]*)"$/ do |field|
92
+ check(field)
93
+ end
94
+
95
+ When /^(?:|I )uncheck "([^"]*)"$/ do |field|
96
+ uncheck(field)
97
+ end
98
+
99
+ When /^(?:|I )choose "([^"]*)"$/ do |field|
100
+ choose(field)
101
+ end
102
+
103
+ When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
104
+ attach_file(field, File.expand_path(path))
105
+ end
106
+
107
+ Then /^(?:|I )should see "([^"]*)"$/ do |text|
108
+ if page.respond_to? :should
109
+ page.should have_content(text)
110
+ else
111
+ assert page.has_content?(text)
112
+ end
113
+ end
114
+
115
+ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
116
+ regexp = Regexp.new(regexp)
117
+
118
+ if page.respond_to? :should
119
+ page.should have_xpath('//*', :text => regexp)
120
+ else
121
+ assert page.has_xpath?('//*', :text => regexp)
122
+ end
123
+ end
124
+
125
+ Then /^(?:|I )should not see "([^"]*)"$/ do |text|
126
+ if page.respond_to? :should
127
+ page.should have_no_content(text)
128
+ else
129
+ assert page.has_no_content?(text)
130
+ end
131
+ end
132
+
133
+ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
134
+ regexp = Regexp.new(regexp)
135
+
136
+ if page.respond_to? :should
137
+ page.should have_no_xpath('//*', :text => regexp)
138
+ else
139
+ assert page.has_no_xpath?('//*', :text => regexp)
140
+ end
141
+ end
142
+
143
+ Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
144
+ with_scope(parent) do
145
+ field = find_field(field)
146
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
147
+ if field_value.respond_to? :should
148
+ field_value.should =~ /#{value}/
149
+ else
150
+ assert_match(/#{value}/, field_value)
151
+ end
152
+ end
153
+ end
154
+
155
+ Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
156
+ with_scope(parent) do
157
+ field = find_field(field)
158
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
159
+ if field_value.respond_to? :should_not
160
+ field_value.should_not =~ /#{value}/
161
+ else
162
+ assert_no_match(/#{value}/, field_value)
163
+ end
164
+ end
165
+ end
166
+
167
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
168
+ with_scope(parent) do
169
+ field_checked = find_field(label)['checked']
170
+ if field_checked.respond_to? :should
171
+ field_checked.should be_true
172
+ else
173
+ assert field_checked
174
+ end
175
+ end
176
+ end
177
+
178
+ Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
179
+ with_scope(parent) do
180
+ field_checked = find_field(label)['checked']
181
+ if field_checked.respond_to? :should
182
+ field_checked.should be_false
183
+ else
184
+ assert !field_checked
185
+ end
186
+ end
187
+ end
188
+
189
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
190
+ current_path = URI.parse(current_url).path
191
+ if current_path.respond_to? :should
192
+ current_path.should == path_to(page_name)
193
+ else
194
+ assert_equal path_to(page_name), current_path
195
+ end
196
+ end
197
+
198
+ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
199
+ query = URI.parse(current_url).query
200
+ actual_params = query ? CGI.parse(query) : {}
201
+ expected_params = {}
202
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
203
+
204
+ if actual_params.respond_to? :should
205
+ actual_params.should == expected_params
206
+ else
207
+ assert_equal expected_params, actual_params
208
+ end
209
+ end
210
+
211
+ Then /^show me the page$/ do
212
+ save_and_open_page
213
+ end
@@ -0,0 +1,67 @@
1
+ # -*- encoding : utf-8 -*-
2
+ # TL;DR: YOU SHOULD DELETE THIS FILE
3
+ #
4
+ # This file iwas generated by Cucumber-Rails and is only here to get you a head start
5
+ # These step definitions are thin wrappers around the Capybara/Webrat API that lets you
6
+ # visit pages, interact with widgets and make assertions about page content.
7
+ #
8
+ # If you use these step definitions as basis for your features you will quickly end up
9
+ # with features that are:
10
+ #
11
+ # * Hard to maintain
12
+ # * Verbose to read
13
+ #
14
+ # A much better approach is to write your own higher level step definitions, following
15
+ # the advice in the following blog posts:
16
+ #
17
+ # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
18
+ # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
19
+ # * http://elabs.se/blog/15-you-re-cuking-it-wrong
20
+ #
21
+
22
+ ENV["RAILS_ENV"] ||= "test"
23
+ require File.expand_path("../../../../tmp/test_app/config/environment.rb", __FILE__)
24
+ ENV["RAILS_ROOT"] ||= File.dirname(__FILE__) + "../../../../tmp/test_app"
25
+
26
+ require 'cucumber/rails'
27
+ #Dir.glob(File.join(File.dirname(__FILE__), '../factories/*.rb')).each {|f| require f }
28
+
29
+ # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
30
+ # order to ease the transition to Capybara we set the default here. If you'd
31
+ # prefer to use XPath just remove this line and adjust any selectors in your
32
+ # steps to use the XPath syntax.
33
+ Capybara.default_selector = :css
34
+
35
+ # By default, any exception happening in your Rails application will bubble up
36
+ # to Cucumber so that your scenario will fail. This is a different from how
37
+ # your application behaves in the production environment, where an error page will
38
+ # be rendered instead.
39
+ #
40
+ # Sometimes we want to override this default behaviour and allow Rails to rescue
41
+ # exceptions and display an error page (just like when the app is running in production).
42
+ # Typical scenarios where you want to do this is when you test your error pages.
43
+ # There are two ways to allow Rails to rescue exceptions:
44
+ #
45
+ # 1) Tag your scenario (or feature) with @allow-rescue
46
+ #
47
+ # 2) Set the value below to true. Beware that doing this globally is not
48
+ # recommended as it will mask a lot of errors for you!
49
+ #
50
+ ActionController::Base.allow_rescue = false
51
+
52
+ # Remove this line if your app doesn't have a database.
53
+ # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
54
+ DatabaseCleaner.strategy = :transaction
55
+
56
+ # Stop endless errors like
57
+ # ~/.rvm/gems/ruby-1.9.2-p0@global/gems/rack-1.2.1/lib/rack/utils.rb:16:
58
+ # warning: regexp match /.../n against to UTF-8 string
59
+ $VERBOSE = nil
60
+
61
+ # include Engine routes in Cucumber world
62
+ module EngineRoutesHelper
63
+ include Atrium::Engine.routes.url_helpers
64
+ end
65
+ World(EngineRoutesHelper)
66
+
67
+
@@ -0,0 +1,76 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module NavigationHelpers
3
+ # Maps a name to a path. Used by the
4
+ #
5
+ # When /^I go to (.+)$/ do |page_name|
6
+ #
7
+ # step definition in web_steps.rb
8
+ #
9
+ def path_to(page_name)
10
+ case page_name
11
+
12
+ when /the home\s?page/
13
+ '/'
14
+
15
+ when /the new collection page/
16
+ new_atrium_collection_path
17
+
18
+ when /the collection search page for id (.+)/
19
+ atrium_collection_home_path($1)
20
+
21
+ when /the edit collection page for id (.+)/
22
+ edit_atrium_collection_path($1)
23
+
24
+ when /the collection home page for id (.+)/
25
+ atrium_collection_path($1)
26
+
27
+ when /the collection page with id (.+) having showcase with id (.+)/
28
+ atrium_collection_showcase_path($1, $2, nil)
29
+
30
+ when /the exhibit home page for id (.+) with facet "([^\"]*)"/
31
+ atrium_exhibit_path($1, :f=>{"pub_date"=>[$2]})
32
+
33
+ when /the exhibit edit page for id (.+)/
34
+ edit_atrium_exhibit_path($1)
35
+
36
+ when /the catalog page/
37
+ catalog_index_path
38
+
39
+ when /the folder page/
40
+ folder_index_path
41
+
42
+ when /the document page for id (.+)/
43
+ catalog_path($1)
44
+
45
+ when /the facet page for "([^\"]*)"/
46
+ catalog_facet_path($1)
47
+
48
+ when /the unAPI endpoint for "([^\"]+)" with format "([^\"]+)"/
49
+ unapi_path(:id => $1, :format => $2)
50
+
51
+ when /the unAPI endpoint for "([^\"]+)"/
52
+ unapi_path(:id => $1)
53
+
54
+ when /the unAPI endpoint/
55
+ unapi_path
56
+
57
+ # Add more mappings here.
58
+ # Here is an example that pulls values out of the Regexp:
59
+ #
60
+ # when /^(.*)'s profile page$/i
61
+ # user_profile_path(User.find_by_login($1))
62
+
63
+ else
64
+ begin
65
+ page_name =~ /the (.*) page/
66
+ path_components = $1.split(/\s+/)
67
+ self.send(path_components.push('path').join('_').to_sym)
68
+ rescue Object => e
69
+ raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
70
+ "Now, go and add a mapping in #{__FILE__}"
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ World(NavigationHelpers)
@@ -0,0 +1,40 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module HtmlSelectorsHelpers
3
+ # Maps a name to a selector. Used primarily by the
4
+ #
5
+ # When /^(.+) within (.+)$/ do |step, scope|
6
+ #
7
+ # step definitions in web_steps.rb
8
+ #
9
+ def selector_for(locator)
10
+ case locator
11
+
12
+ when /the page/
13
+ "html > body"
14
+
15
+ # Add more mappings here.
16
+ # Here is an example that pulls values out of the Regexp:
17
+ #
18
+ # when /the (notice|error|info) flash/
19
+ # ".flash.#{$1}"
20
+
21
+ # You can also return an array to use a different selector
22
+ # type, like:
23
+ #
24
+ # when /the header/
25
+ # [:xpath, "//header"]
26
+
27
+ # This allows you to provide a quoted selector as the scope
28
+ # for "within" steps as was previously the default for the
29
+ # web steps:
30
+ when /"(.+)"/
31
+ $1
32
+
33
+ else
34
+ raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
35
+ "Now, go and add a mapping in #{__FILE__}"
36
+ end
37
+ end
38
+ end
39
+
40
+ World(HtmlSelectorsHelpers)
@@ -0,0 +1,3 @@
1
+ currency_collection:
2
+ id: 1
3
+ title: American Colonial Currency
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Atrium::BaseController do
4
+
5
+ it "should add the necessary helpers to classes that include it" do
6
+ Atrium::BaseController.solr_search_params_logic.should include(:add_exclude_fq_to_solr)
7
+ end
8
+
9
+ it 'should delegate blacklight_config to CatalogController' do
10
+ # CatalogController.expects(:blacklight_config).returns(:returning_value)
11
+ Atrium::BaseController.new.send(:blacklight_config).should == CatalogController.blacklight_config
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Atrium::CollectionExhibitOrderController do
4
+
5
+ describe "Get index" do
6
+ it "should render JSON of session" do
7
+ exhibit_order = {'key' => 'value'}
8
+ mock_collection = mock("collection", :exhibit_order => exhibit_order)
9
+
10
+ Atrium::Collection.stubs(:find).with("1").returns(mock_collection)
11
+ get :index,{ :id=>"1", :format=> "json"}
12
+
13
+ JSON.parse(response.body).should == exhibit_order
14
+ end
15
+ end
16
+
17
+ describe "Post update" do
18
+ it "should render JSON of exhibit order after updating the exhibit order" do
19
+ mock_collection = mock("collection")
20
+ mock_exhibit_order = {"1"=>"2", "2"=>"3","3"=>"1"}
21
+ Atrium::Collection.stubs(:find).with("1").returns(mock_collection)
22
+ mock_collection.expects(:exhibit_order=).with({"3"=>"1", "2"=>"3", "1"=>"2"}).returns(mock_exhibit_order)
23
+ mock_collection.expects("exhibit_order").returns(mock_exhibit_order)
24
+ post :update,{ :id=>"1", :collection =>{"1"=>"2", "2"=>"3", "3"=>"1"}, :format=> "json"}
25
+ response.body.should == mock_exhibit_order.to_json
26
+ end
27
+ end
28
+
29
+ end