Skip to content

Commit

Permalink
Update rspec configuration with latest default settings
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Aug 28, 2016
1 parent e6efdac commit e639134
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ lib/solrmarc.log.*
tmp/*
pkg/*
.internal_test_app
/spec/examples.txt
5 changes: 3 additions & 2 deletions spec/features/search_formats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
before do
# Get all the fields from Solr, so the #index documents have the MARC field (to trigger appropriate
# export formats)
CatalogController.blacklight_config.default_solr_params[:fl] = '*'
current = CatalogController.blacklight_config.default_solr_params
allow(CatalogController.blacklight_config).to receive(:default_solr_params).and_return(current.merge(fl: '*'))
end

it "should have an RSS XML response" do
it "has an RSS XML response" do
visit "/catalog.rss?q="
expect(page).to have_content "Blacklight Search Results"
doc = Nokogiri::XML(page.body)
Expand Down
14 changes: 7 additions & 7 deletions spec/helpers/hash_as_hidden_fields_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

generated = render_hash_as_hidden_fields(@hash)

expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']")
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']")
expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']")
expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']")
expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']")
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']")
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']")
expect(generated).to have_selector("input[type='hidden'][name='q'][value='query']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='page'][value='5']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: false)
expect(generated).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: false)

end

Expand Down
43 changes: 43 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,47 @@

config.include Devise::TestHelpers, type: :controller
config.infer_spec_type_from_file_location!

config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end

config.default_formatter = 'doc' if config.files_to_run.one?

config.shared_context_metadata_behavior = :apply_to_host_groups

# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus

config.example_status_persistence_file_path = 'spec/examples.txt'
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end

# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10

# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random

# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
end

0 comments on commit e639134

Please sign in to comment.