atrium 0.0.1.alpha
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.
- data/.gitignore +13 -0
- data/.gitmodules +3 -0
- data/.rvmrc +32 -0
- data/GETTING_STARTED.textile +109 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +320 -0
- data/Guardfile +10 -0
- data/README.mkd +56 -0
- data/Rakefile +6 -0
- data/app/assets/images/atrium/ajax-loader.gif +0 -0
- data/app/assets/images/atrium/lightbox-ico-loading.gif +0 -0
- data/app/assets/images/atrium/logo.png +0 -0
- data/app/assets/javascripts/atrium/atrium.js +281 -0
- data/app/assets/javascripts/chosen.jquery.js +899 -0
- data/app/assets/javascripts/ckeditor.warning.js +65 -0
- data/app/assets/javascripts/ckeditor/config.js.coffee +6 -0
- data/app/assets/javascripts/ckeditor/jquery.generateId.js +13 -0
- data/app/assets/javascripts/ckeditor/jquery.jeditable.ckeditor.js +59 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/application_link.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/dialogs/linkItem.js +1470 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/plugin.js +16 -0
- data/app/assets/javascripts/ckeditor/plugins/linkItem/ui_toolbar_pencil.png +0 -0
- data/app/assets/javascripts/jquery.colorbox.js +864 -0
- data/app/assets/javascripts/jquery.jeditable.js +543 -0
- data/app/assets/stylesheets/atrium/atrium.css +216 -0
- data/app/assets/stylesheets/atrium/chosen-sprite.png +0 -0
- data/app/assets/stylesheets/atrium/chosen.css +367 -0
- data/app/assets/stylesheets/colorbox.css +42 -0
- data/app/assets/stylesheets/controls.png +0 -0
- data/app/assets/stylesheets/loading.gif +0 -0
- data/app/controllers/atrium/base_controller.rb +25 -0
- data/app/controllers/atrium/collection_exhibit_order_controller.rb +21 -0
- data/app/controllers/atrium/collections_controller.rb +165 -0
- data/app/controllers/atrium/customization_controller.rb +41 -0
- data/app/controllers/atrium/descriptions_controller.rb +177 -0
- data/app/controllers/atrium/exhibit_facet_order_controller.rb +19 -0
- data/app/controllers/atrium/exhibits_controller.rb +108 -0
- data/app/controllers/atrium/showcases_controller.rb +193 -0
- data/app/helpers/atrium/base_helper.rb +6 -0
- data/app/models/ability.rb +14 -0
- data/app/models/atrium/browse_level.rb +41 -0
- data/app/models/atrium/collection.rb +121 -0
- data/app/models/atrium/description.rb +128 -0
- data/app/models/atrium/essay.rb +21 -0
- data/app/models/atrium/exhibit.rb +58 -0
- data/app/models/atrium/search/facet.rb +29 -0
- data/app/models/atrium/search/facet_selection.rb +17 -0
- data/app/models/atrium/showcase.rb +173 -0
- data/app/models/atrium/showcase/facet_selection.rb +21 -0
- data/app/models/atrium/showcase/item.rb +19 -0
- data/app/models/role_mapper.rb +23 -0
- data/app/views/_user_util_links.html.erb +25 -0
- data/app/views/atrium/collections/_bookmark_control.html.erb +25 -0
- data/app/views/atrium/collections/_browse_index.html.erb +20 -0
- data/app/views/atrium/collections/_collection_items_index.html.erb +10 -0
- data/app/views/atrium/collections/_document.html.erb +24 -0
- data/app/views/atrium/collections/_document_list.html.erb +6 -0
- data/app/views/atrium/collections/_edit_navigation.html.erb +20 -0
- data/app/views/atrium/collections/_folder_control.html.erb +12 -0
- data/app/views/atrium/collections/_form.html.erb +93 -0
- data/app/views/atrium/collections/_listing.html.erb +18 -0
- data/app/views/atrium/collections/_navigation.html.erb +45 -0
- data/app/views/atrium/collections/_results_pagination.html.erb +9 -0
- data/app/views/atrium/collections/_sort_and_per_page.html.erb +23 -0
- data/app/views/atrium/collections/edit.html.erb +5 -0
- data/app/views/atrium/collections/new.html.erb +6 -0
- data/app/views/atrium/collections/show.html.erb +22 -0
- data/app/views/atrium/descriptions/_form.html.erb +64 -0
- data/app/views/atrium/descriptions/edit.html.erb +4 -0
- data/app/views/atrium/descriptions/index.html.erb +4 -0
- data/app/views/atrium/descriptions/new.html.erb +2 -0
- data/app/views/atrium/descriptions/show.html.erb +20 -0
- data/app/views/atrium/exhibits/_bookmark_control.html.erb +25 -0
- data/app/views/atrium/exhibits/_folder_control.html.erb +12 -0
- data/app/views/atrium/exhibits/_form.html.erb +108 -0
- data/app/views/atrium/exhibits/edit.html.erb +9 -0
- data/app/views/atrium/exhibits/new.html.erb +6 -0
- data/app/views/atrium/exhibits/show.html.erb +26 -0
- data/app/views/atrium/showcases/_showcase_navigation.html.erb +23 -0
- data/app/views/atrium/showcases/show.html.erb +1 -0
- data/app/views/catalog/_collection_home_text.html.erb +6 -0
- data/app/views/catalog/_constraints.html.erb +9 -0
- data/app/views/catalog/_default_collection_text.html.erb +18 -0
- data/app/views/catalog/_default_home_text.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +6 -0
- data/app/views/catalog/_index_partials/_description.html.erb +8 -0
- data/app/views/catalog/_search_form.html.erb +66 -0
- data/app/views/catalog/_show_partials/_description.html.erb +15 -0
- data/app/views/catalog/browse_show.html.erb +18 -0
- data/app/views/catalog/index.html.erb +35 -0
- data/app/views/catalog/list_description.html.erb +24 -0
- data/app/views/catalog/list_item.html.erb +3 -0
- data/app/views/layouts/atrium.html.erb +86 -0
- data/app/views/layouts/atrium_themes/default.html.erb +4 -0
- data/app/views/layouts/item_listing.html.erb +36 -0
- data/app/views/listing/_document.html.erb +27 -0
- data/app/views/listing/_document_list.html.erb +3 -0
- data/app/views/listing/_item_search.html.erb +27 -0
- data/app/views/shared/_banner.html.erb +5 -0
- data/app/views/shared/_collection_complete_list.html.erb +33 -0
- data/app/views/shared/_collection_search_form.html.erb +12 -0
- data/app/views/shared/_collection_title_header.html.erb +3 -0
- data/app/views/shared/_featured_sources.html.erb +20 -0
- data/app/views/shared/_list_descriptions.html.erb +38 -0
- data/app/views/shared/_navigation_browse_levels.html.erb +34 -0
- data/app/views/shared/_showcase_configure_menu.html.erb +22 -0
- data/app/views/shared/_top_navigation.html.erb +9 -0
- data/atrium.gemspec +76 -0
- data/config/routes.rb +12 -0
- data/init.rb +3 -0
- data/lib/application_controller.rb +24 -0
- data/lib/atrium.rb +42 -0
- data/lib/atrium/application_helper.rb +24 -0
- data/lib/atrium/atrium_helper_behavior.rb +162 -0
- data/lib/atrium/catalog.rb +203 -0
- data/lib/atrium/collections_helper.rb +139 -0
- data/lib/atrium/controller.rb +10 -0
- data/lib/atrium/descriptions_helper.rb +23 -0
- data/lib/atrium/engine.rb +12 -0
- data/lib/atrium/layout_helper.rb +13 -0
- data/lib/atrium/routes.rb +99 -0
- data/lib/atrium/solr_helper.rb +440 -0
- data/lib/atrium/version.rb +3 -0
- data/lib/generators/atrium/assets_generator.rb +44 -0
- data/lib/generators/atrium/atrium_generator.rb +149 -0
- data/lib/generators/atrium/cucumber_support_generator.rb +29 -0
- data/lib/generators/atrium/templates/config/role_map_cucumber.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_development.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_production.yml +2 -0
- data/lib/generators/atrium/templates/config/role_map_test.yml +2 -0
- data/lib/generators/atrium/templates/config/solr.yml +10 -0
- data/lib/generators/atrium/templates/db/seeds.rb +87 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_browse_levels.rb +18 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_collections.rb +20 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_descriptions.rb +16 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_essays.rb +15 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_exhibits.rb +16 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_search_facets.rb +14 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcase_facet_selections.rb +15 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcase_items.rb +17 -0
- data/lib/generators/atrium/templates/migrations/create_atrium_showcases.rb +16 -0
- data/lib/generators/atrium/templates/themes/example.html.erb +21 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/atrium_cucumber.rake +121 -0
- data/lib/railties/index.rake +37 -0
- data/tasks/atrium.rake +268 -0
- data/tasks/atrium_rspec.rake +91 -0
- data/test_support/etc/Gemfile +33 -0
- data/test_support/etc/bundle_config +3 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/atrium_collections.feature +162 -0
- data/test_support/features/atrium_exhibits.feature +164 -0
- data/test_support/features/step_definitions/atrium_collection_steps.rb +102 -0
- data/test_support/features/step_definitions/atrium_exhibit_steps.rb +53 -0
- data/test_support/features/step_definitions/bookmarks_steps.rb +6 -0
- data/test_support/features/step_definitions/error_steps.rb +5 -0
- data/test_support/features/step_definitions/folder_steps.rb +27 -0
- data/test_support/features/step_definitions/general_steps.rb +50 -0
- data/test_support/features/step_definitions/record_view_steps.rb +12 -0
- data/test_support/features/step_definitions/saved_searches_steps.rb +22 -0
- data/test_support/features/step_definitions/search_facets_steps.rb +29 -0
- data/test_support/features/step_definitions/search_history_steps.rb +9 -0
- data/test_support/features/step_definitions/search_result_steps.rb +114 -0
- data/test_support/features/step_definitions/search_steps.rb +103 -0
- data/test_support/features/step_definitions/user_steps.rb +5 -0
- data/test_support/features/step_definitions/web_steps.rb +213 -0
- data/test_support/features/support/env.rb +67 -0
- data/test_support/features/support/paths.rb +76 -0
- data/test_support/features/support/selectors.rb +40 -0
- data/test_support/fixtures/atrium_exhibits.yml +3 -0
- data/test_support/spec/controllers/atrium/base_controller_spec.rb +13 -0
- data/test_support/spec/controllers/atrium/collection_exhibit_order_controller_spec.rb +29 -0
- data/test_support/spec/controllers/atrium/collections_controller_spec.rb +185 -0
- data/test_support/spec/controllers/atrium/customization_controller_spec.rb +38 -0
- data/test_support/spec/controllers/atrium/descriptions_controller_spec.rb +150 -0
- data/test_support/spec/controllers/atrium/exhibit_facet_order_controller_spec.rb +36 -0
- data/test_support/spec/controllers/atrium/exhibits_controller_spec.rb +192 -0
- data/test_support/spec/controllers/atrium/showcases_controller_spec.rb +185 -0
- data/test_support/spec/helpers/atrium_collections_helper_spec.rb +147 -0
- data/test_support/spec/helpers/atrium_description_helper_spec.rb +47 -0
- data/test_support/spec/helpers/atrium_solr_helper_spec.rb +512 -0
- data/test_support/spec/models/atrium/browse_level_spec.rb +31 -0
- data/test_support/spec/models/atrium/collection_spec.rb +30 -0
- data/test_support/spec/models/atrium/description_spec.rb +67 -0
- data/test_support/spec/models/atrium/essay_spec.rb +12 -0
- data/test_support/spec/models/atrium/exhibit_spec.rb +76 -0
- data/test_support/spec/models/atrium/search/facet_selection_spec.rb +24 -0
- data/test_support/spec/models/atrium/search/facet_spec.rb +11 -0
- data/test_support/spec/models/atrium/search_facet_spec.rb +54 -0
- data/test_support/spec/models/atrium/showcase/facet_selection_spec.rb +15 -0
- data/test_support/spec/models/atrium/showcase/item_spec.rb +12 -0
- data/test_support/spec/models/atrium/showcase_facet_selection_spec.rb +65 -0
- data/test_support/spec/models/atrium/showcase_spec.rb +134 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/routing/atrium/collections_routing_spec.rb +33 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +47 -0
- data/test_support/spec/support/be_accessible_matcher.rb +8 -0
- data/test_support/spec/support/be_routed_mixin.rb +7 -0
- data/test_support/tmp/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/tmp/step_definitions/edit_document_steps.rb +67 -0
- data/test_support/tmp/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/tmp/step_definitions/hydra_steps.rb +8 -0
- data/test_support/tmp/step_definitions/search_steps.rb +86 -0
- data/test_support/tmp/step_definitions/searching_steps.rb +22 -0
- data/test_support/tmp/step_definitions/select_steps.rb +8 -0
- data/test_support/tmp/step_definitions/show_document_steps.rb +73 -0
- data/test_support/tmp/step_definitions/user_steps.rb +15 -0
- data/test_support/tmp/step_definitions/web_steps.rb +273 -0
- data/test_support/tmp/support/env.rb +54 -0
- data/test_support/tmp/support/paths.rb +57 -0
- metadata +1047 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
|
2
|
+
|
|
3
|
+
describe 'routing to atrium/collections' do
|
|
4
|
+
extend BeRouted
|
|
5
|
+
be_routed(:get, '/atrium/collections',
|
|
6
|
+
:controller => 'atrium/collections',
|
|
7
|
+
:action => 'index'
|
|
8
|
+
)
|
|
9
|
+
be_routed(:get, '/atrium/collections/new',
|
|
10
|
+
:controller => 'atrium/collections',
|
|
11
|
+
:action => 'new'
|
|
12
|
+
)
|
|
13
|
+
be_routed(:post, '/atrium/collections',
|
|
14
|
+
:controller => 'atrium/collections',
|
|
15
|
+
:action => 'create'
|
|
16
|
+
)
|
|
17
|
+
be_routed(:get, '/atrium/collections/2',
|
|
18
|
+
:controller => 'atrium/collections',
|
|
19
|
+
:action => 'show', :id => '2'
|
|
20
|
+
)
|
|
21
|
+
be_routed(:get, '/atrium/collections/2/edit',
|
|
22
|
+
:controller => 'atrium/collections',
|
|
23
|
+
:action => 'edit', :id => '2'
|
|
24
|
+
)
|
|
25
|
+
be_routed(:put, '/atrium/collections/2',
|
|
26
|
+
:controller => 'atrium/collections',
|
|
27
|
+
:action => 'update', :id => '2'
|
|
28
|
+
)
|
|
29
|
+
be_routed(:delete, '/atrium/collections/2',
|
|
30
|
+
:controller => 'atrium/collections',
|
|
31
|
+
:action => 'destroy', :id => '2'
|
|
32
|
+
)
|
|
33
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
3
|
+
# Has been customized by Blacklight to work when application is in one place,
|
|
4
|
+
# and actual spec/ stuff is in another (the blacklight gem checkout).
|
|
5
|
+
|
|
6
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
7
|
+
|
|
8
|
+
#require File.expand_path("../../config/environment", __FILE__)
|
|
9
|
+
# version that works with our blacklight:spec stuff that calls specs
|
|
10
|
+
# in a remote directory.
|
|
11
|
+
require File.expand_path("config/environment", ENV['RAILS_ROOT'] || File.expand_path("../../../tmp/test_app", __FILE__))
|
|
12
|
+
require 'rspec/rails'
|
|
13
|
+
require 'rspec/autorun'
|
|
14
|
+
require 'rspec/given'
|
|
15
|
+
require 'rspec_on_rails_matchers'
|
|
16
|
+
|
|
17
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
18
|
+
# in spec/support/ and its subdirectories.
|
|
19
|
+
# Blacklight, again, make sure we're looking in the right place for em.
|
|
20
|
+
# Relative to HERE, NOT to Rails.root, which is off somewhere else.
|
|
21
|
+
#Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
|
22
|
+
Dir[Pathname.new(File.expand_path("../support/**/*.rb", __FILE__))].each {|f| require f}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
RSpec.configure do |config|
|
|
26
|
+
# == Mock Framework
|
|
27
|
+
#
|
|
28
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
29
|
+
#
|
|
30
|
+
#= config.mock_with :mocha
|
|
31
|
+
# config.mock_with :flexmock
|
|
32
|
+
# config.mock_with :rr
|
|
33
|
+
#config.mock_with :rspec
|
|
34
|
+
|
|
35
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
36
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
37
|
+
|
|
38
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
39
|
+
# examples within a transaction, remove the following line or assign false
|
|
40
|
+
# instead of true.
|
|
41
|
+
config.use_transactional_fixtures = true
|
|
42
|
+
|
|
43
|
+
def fixture(file)
|
|
44
|
+
File.new(File.join(File.dirname(__FILE__),'..', 'fixtures', file))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
RSpec::Matchers.define :be_accessible do |attribute|
|
|
2
|
+
match do |response|
|
|
3
|
+
response.class.accessible_attributes.include?(attribute)
|
|
4
|
+
end
|
|
5
|
+
description { "be accessible :#{attribute}" }
|
|
6
|
+
failure_message_for_should { ":#{attribute} should be accessible" }
|
|
7
|
+
failure_message_for_should_not { ":#{attribute} should not be accessible" }
|
|
8
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Given /^the following catalog_indices:$/ do |catalog_indices|
|
|
2
|
+
CatalogIndex.create!(catalog_indices.hashes)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
When /^I delete the (\d+)(?:st|nd|rd|th) catalog_index$/ do |pos|
|
|
6
|
+
visit catalog_indices_url
|
|
7
|
+
within("table tr:nth-child(#{pos.to_i+1})") do
|
|
8
|
+
click_link "Destroy"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Then /^I should see the following catalog_indices:$/ do |expected_catalog_indices_table|
|
|
13
|
+
expected_catalog_indices_table.diff!(tableish('table tr', 'td,th'))
|
|
14
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
2
|
+
|
|
3
|
+
Then /^I should see an inline edit containing "([^"]*)"$/ do |arg1|
|
|
4
|
+
response.should have_selector(".editable-text", :content=>arg1)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Then /^the "([^\"]*)" inline edit should contain "([^\"]*)"$/ do |arg1, arg2|
|
|
8
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
9
|
+
dt.each do |term|
|
|
10
|
+
term.next_element.should have_selector("dd ol li.editable") do |editable|
|
|
11
|
+
editable.should have_selector(".editable-text", :content=>arg2)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then /^the "([^\"]*)" inline date edit should contain "([^\"]*)"$/ do |arg1, arg2|
|
|
18
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
19
|
+
dt.each do |term|
|
|
20
|
+
term.next_element.should have_selector("dd div.date-select") do |editable_date_picker|
|
|
21
|
+
editable_date_picker.should have_selector("input.controlled-date-part", :value=>arg2)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# This was failing on some computers that displayed "selected" instead of "selected='selected'", so we made it an option in the next step definition
|
|
28
|
+
Then /^the "([^\"]*)" dropdown edit should be set to "([^\"]*)"$/ do |arg1, arg2|
|
|
29
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
30
|
+
dt.each do |term|
|
|
31
|
+
term.next_element.should have_selector("select") do |dropdown|
|
|
32
|
+
dropdown.should have_selector("option", :content=>arg2, :selected=>"selected")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
Then /^the "([^\"]*)" dropdown edit should contain "([^\"]*)" as an option$/ do |arg1, arg2|
|
|
39
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
40
|
+
dt.each do |term|
|
|
41
|
+
term.next_element.should have_selector("select") do |dropdown|
|
|
42
|
+
dropdown.should have_selector("option", :content=>arg2)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Then /^the "([^\"]*)" inline textarea edit should contain "([^\"]*)"$/ do |arg1, arg2|
|
|
49
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
50
|
+
dt.each do |term|
|
|
51
|
+
term.next_element.should have_selector("dd ol li.editable_textarea") do |editable_textarea|
|
|
52
|
+
editable_textarea.should have_selector(".flc-inlineEdit-text", :content=>arg2)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
Then /^the "([^\"]*)" inline textarea edit should be empty$/ do |arg1|
|
|
59
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
60
|
+
dt.each do |term|
|
|
61
|
+
term.next_element.should have_selector("dd ol li.editable_textarea") do |editable_textarea|
|
|
62
|
+
editable_textarea.should have_selector(".flc-inlineEdit-text", :content=>nil)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This is borrowed from blacklight's record_view_steps.rb
|
|
2
|
+
Then /^I (should|should not) see an? "([^\"]*)" element containing "([^\"]*)"$/ do |bool,elem,content|
|
|
3
|
+
if bool == "should"
|
|
4
|
+
response.should have_selector("#{elem}",:content => content)
|
|
5
|
+
else
|
|
6
|
+
response.should_not have_selector("#{elem}",:content => content)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# User added
|
|
2
|
+
Then /^I should see a search field$/ do
|
|
3
|
+
response.should have_tag("input#q")
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Then /^I should see a selectable list with field choices$/ do
|
|
7
|
+
response.should have_tag("select#search_field")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Then /^I should see a selectable list with per page choices$/ do
|
|
11
|
+
response.should have_tag("select#per_page")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Then /^I should see a "([^\"]*)" button$/ do |label|
|
|
15
|
+
response.should have_tag("input[type=?][value=?]", 'submit', label)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Then /^I should not see the "([^\"]*)" element$/ do |id|
|
|
19
|
+
response.should_not have_tag("##{id}")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Then /^I should see the "([^\"]*)" element$/ do |id|
|
|
23
|
+
response.should have_tag("##{id}")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Given /^the application is configured to have searchable fields "([^\"]*)" with values "([^\"]*)"$/ do |fields, values|
|
|
27
|
+
labels = fields.split(", ")
|
|
28
|
+
values = values.split(", ")
|
|
29
|
+
combined = labels.zip(values)
|
|
30
|
+
Blacklight.config[:search_fields] = []
|
|
31
|
+
combined.each do |pair|
|
|
32
|
+
Blacklight.config[:search_fields] << pair
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Then /^I should see select list "([^\"]*)" with field labels "([^\"]*)"$/ do |list_css, names|
|
|
37
|
+
response.should have_tag(list_css) do
|
|
38
|
+
labels = names.split(", ")
|
|
39
|
+
labels.each do |label|
|
|
40
|
+
with_tag('option', label)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Then /^I should see select list "([^\"]*)" with "([^\"]*)" selected$/ do |list_css, label|
|
|
46
|
+
response.should have_tag(list_css) do |e|
|
|
47
|
+
with_tag("[selected=selected]", {:count => 1}) do
|
|
48
|
+
with_tag("option", {:count => 1, :text => label})
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Results Page
|
|
54
|
+
Given /^the application is configured to have sort fields "([^\"]*)" with values "([^\"]*)"$/ do |fields, values|
|
|
55
|
+
labels = fields.split(", ")
|
|
56
|
+
values = values.split(", ")
|
|
57
|
+
combined = labels.zip(values)
|
|
58
|
+
Blacklight.config[:sort_fields] = []
|
|
59
|
+
combined.each do |pair|
|
|
60
|
+
Blacklight.config[:sort_fields] << pair
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Then /^I should get results$/ do
|
|
65
|
+
response.should have_selector("div.document")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Then /^I should not get results$/ do
|
|
69
|
+
response.should_not have_selector("div.document")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
Then /^I should see the applied filter "([^\"]*)" with the value "([^\"]*)"$/ do |filter, text|
|
|
73
|
+
response.should have_tag("div#facets div") do |node|
|
|
74
|
+
node.should have_selector("h3", :content => filter)
|
|
75
|
+
node.should have_selector("span.selected", :content => text)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Then /^I should see the applied filter "([^\"]*)" with the value
|
|
80
|
+
# "([^\"]*)"$/ do |filter, text|
|
|
81
|
+
# response.should have_tag("div#facets div") do |node|
|
|
82
|
+
# node.should have_selector("h3", :content => filter)
|
|
83
|
+
# node.should have_selector("span.selected", :content => /#{text}.*/)
|
|
84
|
+
# end
|
|
85
|
+
# end
|
|
86
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
2
|
+
|
|
3
|
+
# Gives a way to test how many items are on a given page either gallery or list
|
|
4
|
+
Then /^I should see (\d+) (gallery|list) results$/ do |number,type|
|
|
5
|
+
if type == "gallery"
|
|
6
|
+
results_num = response.body.scan(/<div class=\"document thumbnail\">/).length
|
|
7
|
+
elsif type == "list"
|
|
8
|
+
results_num = response.body.scan(/<tr class=\"document (odd|even)\">/).length
|
|
9
|
+
else
|
|
10
|
+
results_num = -1
|
|
11
|
+
end
|
|
12
|
+
results_num.should == number.to_i
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# simple way to check for elements in the dom (needed for per_page bug check)
|
|
16
|
+
Then /^I (should not|should) see an? "([^\"]*)" tag with an? "([^\"]*)" attribute of "([^\"]*)"$/ do |bool,tag,attribute,value|
|
|
17
|
+
if bool == "should not"
|
|
18
|
+
response.should_not have_tag("#{tag}[#{attribute}*=?]", /^.*#{value}.*$/)
|
|
19
|
+
else
|
|
20
|
+
response.should have_tag("#{tag}[#{attribute}*=?]", /^.*#{value}.*$/)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
2
|
+
|
|
3
|
+
# Terms (dt / dd pairs)
|
|
4
|
+
|
|
5
|
+
Then /^I should see the "([^\"]*)" term$/ do |arg1|
|
|
6
|
+
response.should have_selector("dt", :content=>arg1)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Then /^I should not see the "([^\"]*)" term$/ do |arg1|
|
|
10
|
+
response.should_not have_selector("dt", :content=>arg1)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then /^the "([^\"]*)" term should contain "([^\"]*)"$/ do |arg1, arg2|
|
|
14
|
+
response.should have_selector("dt", :content=>arg1) do |dt|
|
|
15
|
+
dt.each do |term|
|
|
16
|
+
term.next.should have_selector("dd", :content=>arg2)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then /^I should see the "([^\"]*)" value$/ do |arg1|
|
|
22
|
+
pending
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then /^I should see a link to "([^\"]*)"$/ do |arg1|
|
|
26
|
+
response.should have_selector("a", :href=>path_to(arg1))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then /^I should see a link to the "([^\"]*)" page$/ do |arg1|
|
|
30
|
+
response.should have_selector("a", :href=>path_to(arg1))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Then /^I should see a link to "([^\"]*)" with label "([^\"]*)"$/ do |arg1,arg2|
|
|
34
|
+
response.should have_selector("a", :href=>path_to(arg1), :content=>arg2)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Then /^I should not see a link to "([^\"]*)"$/ do |arg1|
|
|
38
|
+
response.should_not have_selector("a", :href=>path_to(arg1))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Then /^I should not see a link to the "([^\"]*)" page$/ do |arg1|
|
|
42
|
+
response.should_not have_selector("a", :href=>path_to(arg1))
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Then /^related links are displayed as urls$/ do
|
|
46
|
+
pending
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Then /^I (should|should not) see a delete (field|contributor) button for "([^\"]*)"$/ do |bool,type,target|
|
|
50
|
+
if bool == "should"
|
|
51
|
+
response.should have_selector("a.destructive", :href=>path_to(target))
|
|
52
|
+
else
|
|
53
|
+
response.should_not have_selector("a", :class=>"destructive #{type}", :href=>path_to(target))
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
Then /^I (should|should not) see a button to delete "([^\"]*)" from "([^\"]*)"$/ do |bool,target,container|
|
|
58
|
+
path_name = "#{target} with #{container} as its container"
|
|
59
|
+
if bool == "should"
|
|
60
|
+
response.should have_selector("a", :class=>"destroy_file_asset", :href=>path_to(path_name))
|
|
61
|
+
else
|
|
62
|
+
response.should_not have_selector("a", :class=>"destroy_file_asset", :href=>path_to(path_name))
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
Then /^I (should|should not) see a delete button for "([^\"]*)"$/ do |bool,target|
|
|
67
|
+
if bool == "should"
|
|
68
|
+
response.should have_selector("a", :class=>"destructive", :href=>path_to(target))
|
|
69
|
+
else
|
|
70
|
+
response.should_not have_selector("a", :class=>"destructive", :href=>path_to(target))
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Given /^I am logged in as "([^\"]*)"$/ do |login|
|
|
2
|
+
email = "#{login}@#{login}.com"
|
|
3
|
+
user = User.create(:login => login, :email => email, :password => "password", :password_confirmation => "password")
|
|
4
|
+
visit user_sessions_path(:user_session => {:login => login, :password => "password"}), :post
|
|
5
|
+
User.find(user.id).should_not be_nil
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
Given /^I am a superuser$/ do
|
|
9
|
+
login = "BigWig"
|
|
10
|
+
email = "bigwig@bigwig.com"
|
|
11
|
+
user = User.create(:login => login, :email => email, :password => "password", :password_confirmation => "password")
|
|
12
|
+
superuser = Superuser.create(:id => 20, :user_id => user.id)
|
|
13
|
+
visit user_sessions_path(:user_session => {:login => login, :password => "password"}), :post
|
|
14
|
+
visit superuser_path
|
|
15
|
+
end
|
|
@@ -0,0 +1,273 @@
|
|
|
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
|
+
|
|
8
|
+
require 'uri'
|
|
9
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
10
|
+
|
|
11
|
+
# Commonly used webrat steps
|
|
12
|
+
# http://github.com/brynary/webrat
|
|
13
|
+
|
|
14
|
+
Given /^(?:|I )am on (.+)$/ do |page_name|
|
|
15
|
+
visit path_to(page_name)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
When /^(?:|I )go to (.+)$/ do |page_name|
|
|
19
|
+
visit path_to(page_name)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
When /^(?:|I )press "([^\"]*)"$/ do |button|
|
|
23
|
+
click_button(button)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
When /^(?:|I )follow "([^\"]*)"$/ do |link|
|
|
27
|
+
click_link(link)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
When /^(?:|I )follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
|
|
31
|
+
click_link_within(parent, link)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
|
35
|
+
fill_in(field, :with => value)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
|
|
39
|
+
fill_in(field, :with => value)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Use this to fill in an entire form with data from a table. Example:
|
|
43
|
+
#
|
|
44
|
+
# When I fill in the following:
|
|
45
|
+
# | Account Number | 5002 |
|
|
46
|
+
# | Expiry date | 2009-11-01 |
|
|
47
|
+
# | Note | Nice guy |
|
|
48
|
+
# | Wants Email? | |
|
|
49
|
+
#
|
|
50
|
+
# TODO: Add support for checkbox, select og option
|
|
51
|
+
# based on naming conventions.
|
|
52
|
+
#
|
|
53
|
+
When /^(?:|I )fill in the following:$/ do |fields|
|
|
54
|
+
fields.rows_hash.each do |name, value|
|
|
55
|
+
When %{I fill in "#{name}" with "#{value}"}
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
When /^(?:|I )select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
|
60
|
+
select(value, :from => field)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
|
64
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
|
65
|
+
When /^(?:|I )select "([^\"]*)" as the date and time$/ do |time|
|
|
66
|
+
select_datetime(time)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
|
70
|
+
# you want to specify which datetime to select. Given the following view:
|
|
71
|
+
# <%= f.label :preferred %><br />
|
|
72
|
+
# <%= f.datetime_select :preferred %>
|
|
73
|
+
# <%= f.label :alternative %><br />
|
|
74
|
+
# <%= f.datetime_select :alternative %>
|
|
75
|
+
# The following steps would fill out the form:
|
|
76
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
|
77
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
|
78
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
|
79
|
+
select_datetime(datetime, :from => datetime_label)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
|
83
|
+
# When I select "2:20PM" as the time
|
|
84
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
|
85
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
|
86
|
+
When /^(?:|I )select "([^\"]*)" as the time$/ do |time|
|
|
87
|
+
select_time(time)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
|
91
|
+
# specify the name of the time on the form. For example:
|
|
92
|
+
# When I select "7:30AM" as the "Gym" time
|
|
93
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
|
94
|
+
select_time(time, :from => time_label)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
|
98
|
+
# When I select "February 20, 1981" as the date
|
|
99
|
+
When /^(?:|I )select "([^\"]*)" as the date$/ do |date|
|
|
100
|
+
select_date(date)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Use this step when using multiple date_select helpers on one page or
|
|
104
|
+
# you want to specify the name of the date on the form. For example:
|
|
105
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
|
106
|
+
When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
|
107
|
+
select_date(date, :from => date_label)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
When /^(?:|I )check "([^\"]*)"$/ do |field|
|
|
111
|
+
check(field)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
When /^(?:|I )uncheck "([^\"]*)"$/ do |field|
|
|
115
|
+
uncheck(field)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
When /^(?:|I )choose "([^\"]*)"$/ do |field|
|
|
119
|
+
choose(field)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Adds support for validates_attachment_content_type. Without the mime-type getting
|
|
123
|
+
# passed to attach_file() you will get a "Photo file is not one of the allowed file types."
|
|
124
|
+
# error message
|
|
125
|
+
When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
|
126
|
+
type = path.split(".")[1]
|
|
127
|
+
|
|
128
|
+
case type
|
|
129
|
+
when "jpg"
|
|
130
|
+
type = "image/jpg"
|
|
131
|
+
when "jpeg"
|
|
132
|
+
type = "image/jpeg"
|
|
133
|
+
when "png"
|
|
134
|
+
type = "image/png"
|
|
135
|
+
when "gif"
|
|
136
|
+
type = "image/gif"
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
attach_file(field, path, type)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
Then /^(?:|I )should see "([^\"]*)"$/ do |text|
|
|
143
|
+
if defined?(Spec::Rails::Matchers)
|
|
144
|
+
response.should contain(text)
|
|
145
|
+
else
|
|
146
|
+
assert_contain text
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
|
151
|
+
within(selector) do |content|
|
|
152
|
+
if defined?(Spec::Rails::Matchers)
|
|
153
|
+
content.should contain(text)
|
|
154
|
+
else
|
|
155
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
|
156
|
+
assert hc.matches?(content), hc.failure_message
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
|
162
|
+
regexp = Regexp.new(regexp)
|
|
163
|
+
if defined?(Spec::Rails::Matchers)
|
|
164
|
+
response.should contain(regexp)
|
|
165
|
+
else
|
|
166
|
+
assert_match(regexp, response_body)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
|
171
|
+
within(selector) do |content|
|
|
172
|
+
regexp = Regexp.new(regexp)
|
|
173
|
+
if defined?(Spec::Rails::Matchers)
|
|
174
|
+
content.should contain(regexp)
|
|
175
|
+
else
|
|
176
|
+
assert_match(regexp, content)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
|
|
182
|
+
if defined?(Spec::Rails::Matchers)
|
|
183
|
+
response.should_not contain(text)
|
|
184
|
+
else
|
|
185
|
+
assert_not_contain(text)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
|
|
190
|
+
within(selector) do |content|
|
|
191
|
+
if defined?(Spec::Rails::Matchers)
|
|
192
|
+
content.should_not contain(text)
|
|
193
|
+
else
|
|
194
|
+
hc = Webrat::Matchers::HasContent.new(text)
|
|
195
|
+
assert !hc.matches?(content), hc.negative_failure_message
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
|
201
|
+
regexp = Regexp.new(regexp)
|
|
202
|
+
if defined?(Spec::Rails::Matchers)
|
|
203
|
+
response.should_not contain(regexp)
|
|
204
|
+
else
|
|
205
|
+
assert_not_contain(regexp)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
|
|
210
|
+
within(selector) do |content|
|
|
211
|
+
regexp = Regexp.new(regexp)
|
|
212
|
+
if defined?(Spec::Rails::Matchers)
|
|
213
|
+
content.should_not contain(regexp)
|
|
214
|
+
else
|
|
215
|
+
assert_no_match(regexp, content)
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
|
221
|
+
if defined?(Spec::Rails::Matchers)
|
|
222
|
+
field_labeled(field).value.should =~ /#{value}/
|
|
223
|
+
else
|
|
224
|
+
assert_match(/#{value}/, field_labeled(field).value)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
|
229
|
+
if defined?(Spec::Rails::Matchers)
|
|
230
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
|
231
|
+
else
|
|
232
|
+
assert_no_match(/#{value}/, field_labeled(field).value)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
|
237
|
+
if defined?(Spec::Rails::Matchers)
|
|
238
|
+
field_labeled(label).should be_checked
|
|
239
|
+
else
|
|
240
|
+
assert field_labeled(label).checked?
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
|
245
|
+
if defined?(Spec::Rails::Matchers)
|
|
246
|
+
field_labeled(label).should_not be_checked
|
|
247
|
+
else
|
|
248
|
+
assert !field_labeled(label).checked?
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
253
|
+
if defined?(Spec::Rails::Matchers)
|
|
254
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
|
255
|
+
else
|
|
256
|
+
assert_equal path_to(page_name), URI.parse(current_url).path
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
261
|
+
actual_params = CGI.parse(URI.parse(current_url).query)
|
|
262
|
+
expected_params = Hash[expected_pairs.rows_hash.map{|k,v| [k,[v]]}]
|
|
263
|
+
|
|
264
|
+
if defined?(Spec::Rails::Matchers)
|
|
265
|
+
actual_params.should == expected_params
|
|
266
|
+
else
|
|
267
|
+
assert_equal expected_params, actual_params
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
Then /^show me the page$/ do
|
|
272
|
+
save_and_open_page
|
|
273
|
+
end
|