blacklight 4.3.0 → 4.4.0
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +0 -6
- data/Gemfile +5 -0
- data/README.md +1 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight/autofocus.js +16 -0
- data/app/assets/javascripts/blacklight/blacklight.js +1 -0
- data/app/assets/javascripts/blacklight/bookmark_toggle.js +2 -5
- data/app/assets/javascripts/blacklight/checkbox_submit.js +3 -6
- data/app/assets/javascripts/blacklight/core.js +24 -1
- data/app/assets/javascripts/blacklight/css_dropdowns.js +2 -2
- data/app/assets/javascripts/blacklight/facet_expand_contract.js +4 -3
- data/app/assets/javascripts/blacklight/lightbox_dialog.js +7 -1
- data/app/assets/javascripts/blacklight/search_context.js +1 -1
- data/app/assets/javascripts/blacklight/select_submit.js +1 -1
- data/app/assets/javascripts/blacklight/zebra_stripe.js +1 -1
- data/app/assets/stylesheets/blacklight/_blacklight_base.css.scss +1 -0
- data/app/assets/stylesheets/blacklight/_catalog.css.scss +5 -0
- data/app/assets/stylesheets/blacklight/_facets.css.scss +6 -0
- data/app/assets/stylesheets/blacklight/_group.css.scss +14 -0
- data/app/assets/stylesheets/blacklight/blacklight_defaults.css.scss +1 -0
- data/app/controllers/bookmarks_controller.rb +2 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +41 -24
- data/app/helpers/blacklight/catalog_helper_behavior.rb +48 -28
- data/app/helpers/blacklight/facets_helper_behavior.rb +9 -75
- data/app/models/record_mailer.rb +1 -16
- data/app/views/bookmarks/index.html.erb +2 -0
- data/app/views/catalog/_bookmark_control.html.erb +3 -4
- data/app/views/catalog/_document.html.erb +2 -1
- data/app/views/catalog/_document_header.html.erb +6 -3
- data/app/views/catalog/_email_form.html.erb +0 -7
- data/app/views/catalog/_facet_layout.html.erb +1 -1
- data/app/views/catalog/_group_default.html.erb +12 -0
- data/app/views/catalog/_index_default.html.erb +1 -1
- data/app/views/catalog/_opensearch_response_metadata.html.erb +2 -3
- data/app/views/catalog/_paginate_compact.html.erb +2 -2
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_sms_form.html.erb +1 -21
- data/app/views/catalog/_thumbnail_default.html.erb +5 -0
- data/app/views/catalog/email_sent.html.erb +9 -0
- data/app/views/catalog/index.atom.builder +7 -8
- data/app/views/catalog/index.html.erb +6 -3
- data/app/views/catalog/librarian_view.html.erb +1 -1
- data/app/views/catalog/sms_sent.html.erb +9 -0
- data/app/views/feedback/complete.html.erb +2 -0
- data/app/views/feedback/show.html.erb +7 -5
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -1
- data/app/views/layouts/blacklight.html.erb +1 -2
- data/app/views/saved_searches/index.html.erb +2 -0
- data/app/views/search_history/index.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/locales/blacklight.en.yml +11 -0
- data/config/locales/blacklight.fr.yml +15 -1
- data/gemfiles/rails3.gemfile +7 -0
- data/gemfiles/rails4.gemfile +7 -0
- data/lib/blacklight.rb +1 -0
- data/lib/blacklight/catalog.rb +101 -56
- data/lib/blacklight/configuration.rb +1 -1
- data/lib/blacklight/controller.rb +7 -4
- data/lib/blacklight/facet.rb +79 -0
- data/lib/blacklight/routes.rb +0 -1
- data/lib/blacklight/solr/document.rb +4 -0
- data/lib/blacklight/solr/document/marc_export.rb +1 -1
- data/lib/blacklight/solr_helper.rb +39 -8
- data/lib/blacklight/solr_response.rb +35 -3
- data/lib/blacklight/solr_response/facets.rb +4 -0
- data/lib/blacklight/solr_response/group.rb +33 -0
- data/lib/blacklight/solr_response/group_response.rb +49 -0
- data/lib/blacklight/solr_response/pagination_methods.rb +27 -0
- data/lib/blacklight/user.rb +30 -32
- data/lib/generators/blacklight/assets_generator.rb +3 -1
- data/lib/generators/blacklight/blacklight_generator.rb +28 -125
- data/lib/generators/blacklight/marc_generator.rb +66 -0
- data/lib/generators/blacklight/models_generator.rb +113 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +9 -0
- data/lib/generators/blacklight/templates/config/solr.yml +0 -2
- data/lib/generators/blacklight/templates/solr_document.rb +1 -13
- data/lib/railties/all_tests.rake +5 -8
- data/spec/controllers/catalog_controller_spec.rb +185 -113
- data/spec/features/alternate_controller_spec.rb +34 -0
- data/spec/features/bookmarks_spec.rb +58 -0
- data/spec/features/did_you_mean_spec.rb +135 -0
- data/spec/features/librarian_view_spec.rb +13 -0
- data/spec/features/record_view_spec.rb +37 -0
- data/spec/features/saved_searches_spec.rb +47 -0
- data/spec/features/search_filters_spec.rb +137 -0
- data/spec/features/search_history_spec.rb +75 -0
- data/spec/features/search_pagination_spec.rb +91 -0
- data/spec/features/search_results_spec.rb +68 -0
- data/spec/features/search_sort_spec.rb +20 -0
- data/spec/features/search_spec.rb +108 -0
- data/spec/helpers/blacklight_helper_spec.rb +45 -2
- data/spec/helpers/catalog_helper_spec.rb +134 -1
- data/spec/helpers/facets_helper_spec.rb +8 -0
- data/spec/lib/blacklight/solr_response/group_response_spec.rb +78 -0
- data/spec/lib/blacklight/solr_response/group_spec.rb +70 -0
- data/spec/lib/blacklight_solr_response_spec.rb +11 -5
- data/spec/lib/blacklight_user_spec.rb +22 -41
- data/spec/lib/solr_helper_spec.rb +73 -1
- data/spec/models/record_mailer_spec.rb +3 -3
- data/spec/models/{solr_docment_spec.rb → solr_document_spec.rb} +1 -1
- data/spec/spec_helper.rb +0 -1
- data/spec/support/features.rb +7 -0
- data/spec/support/features/session_helpers.rb +22 -0
- data/spec/test_app_templates/Gemfile.extra +0 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -6
- data/spec/test_app_templates/lib/tasks/blacklight_test_app.rake +1 -9
- data/spec/views/catalog/_facets.html.erb_spec.rb +2 -1
- data/tasks/blacklight.rake +0 -10
- metadata +49 -58
- data/features/bookmarks.feature +0 -68
- data/features/did_you_mean.feature +0 -123
- data/features/librarian_view.feature +0 -18
- data/features/record_view.feature +0 -40
- data/features/saved_searches.feature +0 -49
- data/features/search.feature +0 -83
- data/features/search_filters.feature +0 -119
- data/features/search_history.feature +0 -85
- data/features/search_pagination.feature +0 -53
- data/features/search_results.feature +0 -61
- data/features/search_sort.feature +0 -27
- data/features/step_definitions/bookmarks_steps.rb +0 -6
- data/features/step_definitions/error_steps.rb +0 -5
- data/features/step_definitions/general_steps.rb +0 -50
- data/features/step_definitions/record_view_steps.rb +0 -12
- data/features/step_definitions/saved_searches_steps.rb +0 -19
- data/features/step_definitions/search_facets_steps.rb +0 -29
- data/features/step_definitions/search_history_steps.rb +0 -9
- data/features/step_definitions/search_pagination_steps.rb +0 -29
- data/features/step_definitions/search_result_steps.rb +0 -115
- data/features/step_definitions/search_steps.rb +0 -118
- data/features/step_definitions/user_steps.rb +0 -5
- data/features/step_definitions/web_steps.rb +0 -217
- data/features/support/env.rb +0 -65
- data/features/support/paths.rb +0 -48
- data/features/support/selectors.rb +0 -40
- data/lib/railties/blacklight_cucumber.rake +0 -126
- data/lib/solrmarc.log.1 +0 -854
|
@@ -1,5 +0,0 @@
|
|
|
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
|
|
@@ -1,217 +0,0 @@
|
|
|
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
|
-
click_button(button)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
When /^(?:|I )follow "([^"]*)"$/ do |link|
|
|
58
|
-
click_link(link)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
|
62
|
-
fill_in(field, :with => value)
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
|
66
|
-
fill_in(field, :with => value)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# Use this to fill in an entire form with data from a table. Example:
|
|
70
|
-
#
|
|
71
|
-
# When I fill in the following:
|
|
72
|
-
# | Account Number | 5002 |
|
|
73
|
-
# | Expiry date | 2009-11-01 |
|
|
74
|
-
# | Note | Nice guy |
|
|
75
|
-
# | Wants Email? | |
|
|
76
|
-
#
|
|
77
|
-
# TODO: Add support for checkbox, select og option
|
|
78
|
-
# based on naming conventions.
|
|
79
|
-
#
|
|
80
|
-
When /^(?:|I )fill in the following:$/ do |fields|
|
|
81
|
-
fields.rows_hash.each do |name, value|
|
|
82
|
-
When %{I fill in "#{name}" with "#{value}"}
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
|
87
|
-
select(value, :from => field)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
When /^(?:|I )check "([^"]*)"$/ do |field|
|
|
91
|
-
check(field)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
When /^(?:|I )uncheck "([^"]*)"$/ do |field|
|
|
95
|
-
uncheck(field)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
When /^(?:|I )choose "([^"]*)"$/ do |field|
|
|
99
|
-
choose(field)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
|
103
|
-
attach_file(field, File.expand_path(path))
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
|
107
|
-
if page.respond_to? :should
|
|
108
|
-
page.should have_content(text)
|
|
109
|
-
else
|
|
110
|
-
assert page.has_content?(text)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
|
115
|
-
regexp = Regexp.new(regexp)
|
|
116
|
-
|
|
117
|
-
if page.respond_to? :should
|
|
118
|
-
page.should have_xpath('//*', :text => regexp)
|
|
119
|
-
else
|
|
120
|
-
assert page.has_xpath?('//*', :text => regexp)
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
|
125
|
-
if page.respond_to? :should
|
|
126
|
-
page.should have_no_content(text)
|
|
127
|
-
else
|
|
128
|
-
assert page.has_no_content?(text)
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
|
133
|
-
regexp = Regexp.new(regexp)
|
|
134
|
-
|
|
135
|
-
if page.respond_to? :should
|
|
136
|
-
page.should have_no_xpath('//*', :text => regexp)
|
|
137
|
-
else
|
|
138
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
|
|
143
|
-
with_scope(parent) do
|
|
144
|
-
field = find_field(field)
|
|
145
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
146
|
-
if field_value.respond_to? :should
|
|
147
|
-
field_value.should =~ /#{value}/
|
|
148
|
-
else
|
|
149
|
-
assert_match(/#{value}/, field_value)
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
|
|
155
|
-
with_scope(parent) do
|
|
156
|
-
field = find_field(field)
|
|
157
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
158
|
-
if field_value.respond_to? :should_not
|
|
159
|
-
field_value.should_not =~ /#{value}/
|
|
160
|
-
else
|
|
161
|
-
assert_no_match(/#{value}/, field_value)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
|
|
167
|
-
with_scope(parent) do
|
|
168
|
-
field_checked = find_field(label)['checked']
|
|
169
|
-
if field_checked.respond_to? :should
|
|
170
|
-
field_checked.should be_true
|
|
171
|
-
else
|
|
172
|
-
assert field_checked
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
|
|
178
|
-
with_scope(parent) do
|
|
179
|
-
field_checked = find_field(label)['checked']
|
|
180
|
-
if field_checked.respond_to? :should
|
|
181
|
-
field_checked.should be_false
|
|
182
|
-
else
|
|
183
|
-
assert !field_checked
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
189
|
-
current_path = URI.parse(current_url).path
|
|
190
|
-
if current_path.respond_to? :should
|
|
191
|
-
current_path.should == path_to(page_name)
|
|
192
|
-
else
|
|
193
|
-
assert_equal path_to(page_name), current_path
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
198
|
-
query = URI.parse(current_url).query
|
|
199
|
-
actual_params = query ? CGI.parse(query) : {}
|
|
200
|
-
expected_params = {}
|
|
201
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
|
202
|
-
|
|
203
|
-
if actual_params.respond_to? :should
|
|
204
|
-
actual_params.should == expected_params
|
|
205
|
-
else
|
|
206
|
-
assert_equal expected_params, actual_params
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
Then /^show me the page$/ do
|
|
211
|
-
save_and_open_page
|
|
212
|
-
end
|
|
213
|
-
|
|
214
|
-
Then /^I should get a status code (\d+)/ do |http_status|
|
|
215
|
-
page.driver.status_code.should == http_status.to_i
|
|
216
|
-
end
|
|
217
|
-
|
data/features/support/env.rb
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
23
|
-
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/ and ruby_engine != "jruby"
|
|
24
|
-
require 'simplecov'
|
|
25
|
-
require 'simplecov-rcov'
|
|
26
|
-
|
|
27
|
-
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
|
28
|
-
SimpleCov.start do
|
|
29
|
-
root File.expand_path(File.dirname(__FILE__) + "../../../..")
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
require 'cucumber/rails'
|
|
34
|
-
|
|
35
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
|
36
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
|
37
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
|
38
|
-
# steps to use the XPath syntax.
|
|
39
|
-
Capybara.default_selector = :css
|
|
40
|
-
|
|
41
|
-
# By default, any exception happening in your Rails application will bubble up
|
|
42
|
-
# to Cucumber so that your scenario will fail. This is a different from how
|
|
43
|
-
# your application behaves in the production environment, where an error page will
|
|
44
|
-
# be rendered instead.
|
|
45
|
-
#
|
|
46
|
-
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
|
47
|
-
# exceptions and display an error page (just like when the app is running in production).
|
|
48
|
-
# Typical scenarios where you want to do this is when you test your error pages.
|
|
49
|
-
# There are two ways to allow Rails to rescue exceptions:
|
|
50
|
-
#
|
|
51
|
-
# 1) Tag your scenario (or feature) with @allow-rescue
|
|
52
|
-
#
|
|
53
|
-
# 2) Set the value below to true. Beware that doing this globally is not
|
|
54
|
-
# recommended as it will mask a lot of errors for you!
|
|
55
|
-
#
|
|
56
|
-
ActionController::Base.allow_rescue = false
|
|
57
|
-
|
|
58
|
-
# Remove this line if your app doesn't have a database.
|
|
59
|
-
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
|
60
|
-
DatabaseCleaner.strategy = :transaction
|
|
61
|
-
|
|
62
|
-
# Stop endless errors like
|
|
63
|
-
# ~/.rvm/gems/ruby-1.9.2-p0@global/gems/rack-1.2.1/lib/rack/utils.rb:16:
|
|
64
|
-
# warning: regexp match /.../n against to UTF-8 string
|
|
65
|
-
$VERBOSE = nil
|
data/features/support/paths.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
|
|
16
|
-
when /the catalog page/
|
|
17
|
-
#catalog_index_path
|
|
18
|
-
root_path
|
|
19
|
-
|
|
20
|
-
when /the bookmarks page/
|
|
21
|
-
bookmarks_path
|
|
22
|
-
|
|
23
|
-
when /the document page for id (.+)/
|
|
24
|
-
catalog_path($1)
|
|
25
|
-
|
|
26
|
-
when /the facet page for "([^\"]*)"/
|
|
27
|
-
catalog_facet_path($1)
|
|
28
|
-
|
|
29
|
-
# Add more mappings here.
|
|
30
|
-
# Here is an example that pulls values out of the Regexp:
|
|
31
|
-
#
|
|
32
|
-
# when /^(.*)'s profile page$/i
|
|
33
|
-
# user_profile_path(User.find_by_login($1))
|
|
34
|
-
|
|
35
|
-
else
|
|
36
|
-
begin
|
|
37
|
-
page_name =~ /the (.*) page/
|
|
38
|
-
path_components = $1.split(/\s+/)
|
|
39
|
-
self.send(path_components.push('path').join('_').to_sym)
|
|
40
|
-
rescue Object => e
|
|
41
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
|
42
|
-
"Now, go and add a mapping in #{__FILE__}"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
World(NavigationHelpers)
|
|
@@ -1,40 +0,0 @@
|
|
|
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)
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
|
5
|
-
# files.
|
|
6
|
-
|
|
7
|
-
# Blacklight customization, trick Cucumber into looking in our current
|
|
8
|
-
# location for Rails.root, even though we're going to give it features
|
|
9
|
-
# from elsewhere.
|
|
10
|
-
ENV['RAILS_ROOT'] = Rails.root.to_s
|
|
11
|
-
|
|
12
|
-
# blacklight_features, where to find features inside blacklight source?
|
|
13
|
-
blacklight_features = File.expand_path("features", Blacklight.root)
|
|
14
|
-
|
|
15
|
-
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
|
16
|
-
|
|
17
|
-
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
|
18
|
-
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
|
19
|
-
|
|
20
|
-
begin
|
|
21
|
-
require 'cucumber/rake/task'
|
|
22
|
-
|
|
23
|
-
namespace :blacklight do
|
|
24
|
-
namespace :cucumber do
|
|
25
|
-
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
|
26
|
-
# Blacklight customization, call features from external location, pass
|
|
27
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
|
28
|
-
t.cucumber_opts = blacklight_features + " --format progress"
|
|
29
|
-
|
|
30
|
-
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
|
31
|
-
t.fork = true # You may get faster startup if you set this to false
|
|
32
|
-
t.profile = 'default'
|
|
33
|
-
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
34
|
-
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
|
35
|
-
t.rcov = true
|
|
36
|
-
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
|
37
|
-
t.rcov_opts << %[-o "../../coverage/rcov"]
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
|
42
|
-
# Blacklight customization, call features from external location, pass
|
|
43
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
|
44
|
-
t.cucumber_opts = blacklight_features
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
t.binary = vendored_cucumber_bin
|
|
48
|
-
t.fork = true # You may get faster startup if you set this to false
|
|
49
|
-
t.profile = 'wip'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
|
53
|
-
# Blacklight customization, call features from external location, pass
|
|
54
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
|
55
|
-
t.cucumber_opts = blacklight_features
|
|
56
|
-
|
|
57
|
-
t.binary = vendored_cucumber_bin
|
|
58
|
-
t.fork = true # You may get faster startup if you set this to false
|
|
59
|
-
t.profile = 'rerun'
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
if (RUBY_VERSION.to_f < 1.9) then
|
|
63
|
-
Cucumber::Rake::Task.new({:rcov => 'db:test:prepare'}, 'Run features with rcov') do |t|
|
|
64
|
-
# Blacklight customization, call features from external location, pass
|
|
65
|
-
# in feature location wtih cucumber_opts, yeah it's weird but that's how.
|
|
66
|
-
t.cucumber_opts = blacklight_features
|
|
67
|
-
|
|
68
|
-
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
|
69
|
-
t.fork = true # You may get faster startup if you set this to false
|
|
70
|
-
t.profile = 'default'
|
|
71
|
-
ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby"
|
|
72
|
-
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/ and ruby_engine != "jruby"
|
|
73
|
-
t.rcov = true
|
|
74
|
-
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate blacklight-coverage.data}
|
|
75
|
-
t.rcov_opts << %[-o "../../coverage/rcov"]
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
desc 'Run all features'
|
|
81
|
-
task :all => [:ok, :wip]
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
# Solr wrapper. for now just for blacklight:cucumber, plan to
|
|
85
|
-
# provide it for all variants eventually.
|
|
86
|
-
# if you would like to see solr startup messages on STDERR
|
|
87
|
-
# when starting solr test server during functional tests use:
|
|
88
|
-
#
|
|
89
|
-
# rake SOLR_CONSOLE=true
|
|
90
|
-
desc "blacklight:cucumber with jetty/solr launch"
|
|
91
|
-
task :with_solr do
|
|
92
|
-
require 'jettywrapper'
|
|
93
|
-
|
|
94
|
-
Rails.env = 'test' unless ENV['RAILS_ENV']
|
|
95
|
-
error = Jettywrapper.wrap(Jettywrapper.load_config) do
|
|
96
|
-
Rake::Task["blacklight:cucumber"].invoke
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
raise "test failures: #{error}" if error
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
desc 'Alias for blacklight:cucumber:ok'
|
|
105
|
-
task :cucumber => 'blacklight:cucumber:ok'
|
|
106
|
-
|
|
107
|
-
end
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
task :features => :cucumber do
|
|
113
|
-
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
|
117
|
-
task 'db:test:prepare' do
|
|
118
|
-
end
|
|
119
|
-
rescue LoadError
|
|
120
|
-
desc 'cucumber rake task not available (cucumber not installed)'
|
|
121
|
-
task :cucumber do
|
|
122
|
-
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
end
|