Skip to content

Commit

Permalink
Do not use should when describing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Jun 29, 2016
1 parent a7451f6 commit b55c3ae
Show file tree
Hide file tree
Showing 35 changed files with 406 additions and 398 deletions.
4 changes: 2 additions & 2 deletions spec/controllers/alternate_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

describe AlternateController do
describe "the search results tools" do
it "should inherit tools from CatalogController" do
it "inherits tools from CatalogController" do
expect(AlternateController.blacklight_config.index.document_actions).to have_key(:bookmark)
end

context "when deleting partials from the AlternateController" do
before do
AlternateController.blacklight_config.index.document_actions.delete(:bookmark)
end
it "should not affect the CatalogController" do
it "does not affect the CatalogController" do
expect(AlternateController.blacklight_config.index.document_actions).to be_empty
expect(CatalogController.blacklight_config.index.document_actions).to have_key(:bookmark)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/application_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

describe "#blacklight_config" do

it "should provide a default blacklight_config everywhere" do
it "provides a default blacklight_config everywhere" do
expect(controller.blacklight_config).to eq CatalogController.blacklight_config
end
end
Expand Down
130 changes: 65 additions & 65 deletions spec/controllers/catalog_controller_spec.rb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions spec/controllers/saved_searches_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
end

describe "save" do
it "should let you save a search" do
it "lets you save a search" do
request.env["HTTP_REFERER"] = "where_i_came_from"
session[:history] = [@one.id]
post :save, params: { id: @one.id }
expect(response).to redirect_to "where_i_came_from"
end

it "should not let you save a search that isn't in your search history" do
it "does not let you save a search that isn't in your search history" do
session[:history] = [@one.id]
expect {
post :save, params: { id: @two.id }
Expand Down
6 changes: 3 additions & 3 deletions spec/controllers/search_history_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@three = Search.create
end

it "should only fetch searches with ids in the session" do
it "onlies fetch searches with ids in the session" do
session[:history] = [@one.id, @three.id]
get :index
@searches = assigns(:searches)
Expand All @@ -21,7 +21,7 @@
expect(@searches).to_not include(@two)
end

it "should tolerate bad ids in session" do
it "tolerates bad ids in session" do
session[:history] = [@one.id, @three.id, "NOT_IN_DB"]
get :index
@searches = assigns(:searches)
Expand All @@ -30,7 +30,7 @@
expect(@searches).to include(@three)
end

it "should not fetch any searches if there is no history" do
it "does not fetch any searches if there is no history" do
session[:history] = []
get :index
@searches = assigns(:searches)
Expand Down
6 changes: 3 additions & 3 deletions spec/features/alternate_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'spec_helper'

describe "Alternate Controller Behaviors" do
it "should have the correct per-page form" do
it "has the correct per-page form" do
visit search_alternate_path
expect(page).to have_selector("form[action='#{search_alternate_url}']")
fill_in "q", :with=>"history"
Expand All @@ -14,7 +14,7 @@
expect(current_path).to match /#{search_alternate_path}/
end

it "should have the correct search field form" do
it "has the correct search field form" do
visit search_alternate_path
expect(page).to have_selector("form[action='#{search_alternate_url}']")
fill_in "q", :with=>"history"
Expand All @@ -24,7 +24,7 @@
expect(current_path).to match /#{search_alternate_path}/
end

it "should display document thumbnails" do
it "displays document thumbnails" do
visit search_alternate_path
expect(page).to have_selector("form[action='#{search_alternate_url}']")
fill_in "q", :with=>"history"
Expand Down
12 changes: 6 additions & 6 deletions spec/features/bookmarks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

describe "Bookmarks" do
describe "navigating from the homepage" do
it "should have a link to the history page" do
it "has a link to the history page" do
sign_in 'user1'
visit root_path
click_link 'Bookmarks'
expect(page).to have_content 'You have no bookmarks'
end
end

it "should clear bookmarks" do
it "clears bookmarks" do
visit solr_document_path('2007020969')
click_button 'Bookmark'
click_link 'Bookmarks'
Expand All @@ -33,15 +33,15 @@
expect(page).to have_content 'Successfully removed bookmark.'
end

it "should add and delete bookmarks from the show page" do
it "adds and delete bookmarks from the show page" do
sign_in 'user1'
visit solr_document_path('2007020969')
click_button 'Bookmark'
click_button 'Remove bookmark'
expect(page).to have_content 'Successfully removed bookmark.'
end

it "should add bookmarks after a user logs in" do
it "adds bookmarks after a user logs in" do
visit solr_document_path('2007020969')
click_button 'Bookmark'
sign_in 'user1'
Expand All @@ -50,15 +50,15 @@
expect(page).to have_content("Strong Medicine speaks")
end

it "should cite items in bookmarks" do
it "cites items in bookmarks" do
visit solr_document_path('2007020969')
click_button 'Bookmark'
click_link 'Bookmarks'
click_link 'Cite'
expect(page).to have_content 'Strong Medicine speaks'
end

it "should cite items in current bookmarks page" do
it "cites items in current bookmarks page" do
visit solr_document_path('2009373513')
click_button 'Bookmark'

Expand Down
20 changes: 10 additions & 10 deletions spec/features/did_you_mean_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
before { visit root_path }

describe "searching all fields" do
it "should have suggestions" do
it "has suggestions" do
fill_in "q", with: 'politica'
click_button 'search'

Expand All @@ -19,7 +19,7 @@

describe "for a title search" do
before { select 'Title', from: 'search_field' }
it "should have suggestions" do
it "has suggestions" do
# yehudiyam is one letter away from a title word
fill_in "q", with: 'yehudiyam'
click_button 'search'
Expand All @@ -37,7 +37,7 @@

describe "for an author search" do
before { select 'Author', from: 'search_field' }
it "should have suggestions" do
it "has suggestions" do
# shirma is one letter away from an author word
fill_in "q", with: 'shirma'
click_button 'search'
Expand All @@ -55,7 +55,7 @@

describe "for an subject search" do
before { select 'Subject', from: 'search_field' }
it "should have suggestions" do
it "has suggestions" do
# wome is one letter away from an author word
fill_in "q", with: 'wome'
click_button 'search'
Expand All @@ -72,14 +72,14 @@
end

describe "a multiword query" do
it "should not have suggestions if there are no matches" do
it "does not have suggestions if there are no matches" do
fill_in "q", with: 'ooofda ooofda'
click_button 'search'

expect(page).to_not have_content("Did you mean")
end

it "should have separate suggestions" do
it "has separate suggestions" do
fill_in "q", with: 'politica boo'
click_button 'search'

Expand All @@ -96,7 +96,7 @@
end
end

it "should ignore repeated terms" do
it "ignores repeated terms" do
fill_in "q", with: 'boo boo'
click_button 'search'

Expand All @@ -108,7 +108,7 @@
end
end

it "should show suggestions if there aren't many hits" do
it "shows suggestions if there aren't many hits" do
fill_in "q", with: 'ayaz'
click_button 'search'

Expand All @@ -119,14 +119,14 @@
end
end

it "should should not show suggestions if there are many results" do
it "does not show suggestions if there are many results" do
# histori gives 9 results in 30 record demo index
fill_in "q", with: 'histori'
click_button 'search'
expect(page).to_not have_content("Did you mean")
end

it "should should show suggestions if at the threshold number" do
it "shows suggestions if at the threshold number" do
# polit gives 5 results in 30 record demo index - 5 is default cutoff
fill_in "q", with: 'polit'
click_button 'search'
Expand Down
8 changes: 4 additions & 4 deletions spec/features/facets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
require 'spec_helper'

describe "Facets" do
it "should show a single facet's values" do
it "shows a single facet's values" do
visit facet_catalog_path("language_facet")
expect(page).to have_selector ".modal-title", :text => "Language"
expect(page).to have_selector ".facet_select", :text => "Tibetan"
end

it "should paginate through a facet's values" do
it "paginates through a facet's values" do
visit facet_catalog_path("subject_topic_facet")
expect(page).to have_selector '.facet-values li:first', text: "Japanese drama"
expect(page).to have_link "A-Z Sort"
Expand All @@ -20,7 +20,7 @@
expect(page).to have_link "« Previous"
end

it "should be able to change the facet sort" do
it "is able to change the facet sort" do
visit facet_catalog_path("subject_topic_facet")
expect(page).to have_selector '.facet-values li:first', text: "Japanese drama"
within ".modal-footer" do
Expand All @@ -31,7 +31,7 @@
expect(page).to have_selector '.sort_options .active', text: "A-Z Sort"
end

it "should be able to sort more facet window by letter" do
it "is able to sort more facet window by letter" do
visit facet_catalog_path("subject_topic_facet")
within ".modal-footer" do
click_on "A-Z Sort"
Expand Down
8 changes: 4 additions & 4 deletions spec/features/record_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'spec_helper'

describe "Record View" do
it "should display a normal record" do
it "displays a normal record" do
visit solr_document_path('2007020969')
expect(page).to have_content "Title:"
expect(page).to have_content "Strong Medicine speaks"
Expand All @@ -21,18 +21,18 @@

end

it "should not display blank titles" do
it "does not display blank titles" do
visit solr_document_path('2008305903')
expect(page).not_to have_content "More Information:"
end

it "should not display vernacular records" do
it "does not display vernacular records" do
visit solr_document_path('2009373513')
expect(page).to have_content "次按驟變"
expect(page).to have_content "林行止"
expect(page).to have_content "臺北縣板橋市"
end
it "should not display 404" do
it "does not display 404" do
visit solr_document_path('this_id_does_not_exist')
expect(page.driver.status_code).to eq 404
expect(page).to have_content "The page you were looking for doesn't exist."
Expand Down
8 changes: 4 additions & 4 deletions spec/features/saved_searches_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
visit root_path
end

it "should be empty" do
it "is empty" do
click_link 'Saved Searches'
expect(page).to have_content 'You have no saved searches'
end
Expand All @@ -20,11 +20,11 @@
click_button "save"
click_link 'Saved Searches'
end
it "should show saved searches" do
it "shows saved searches" do
expect(page).to have_content 'Your saved searches'
expect(page).to have_content 'book'
end
it "should delete saved searches" do
it "deletes saved searches" do
click_button 'delete'
expect(page).to have_content 'Successfully removed that saved search.'
end
Expand All @@ -38,7 +38,7 @@
click_button "save"
click_link 'Saved Searches'
end
it "should clear the searhes" do
it "clears the searhes" do
click_link "Clear Saved Searches"
expect(page).to have_content 'Cleared your saved searches.'
expect(page).to have_content 'You have no saved searches'
Expand Down
8 changes: 4 additions & 4 deletions spec/features/search_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require 'spec_helper'

describe "Search Results context", js: true do
it "should pass the current search id through" do
it "passes the current search id through" do
search_for ''
search_id = Search.last.id.to_s
click_on 'Pluvial nectar of blessings'
Expand All @@ -16,14 +16,14 @@
expect(prev['data-context-href']).to eq "/catalog/2004310986/track?counter=8&search_id=#{search_id}"
end

it "should redirect context urls to the original url" do
it "redirects context urls to the original url" do
search_for ''
first('.index_title a').click
expect(page).to have_content "« Previous | 1 of 30 | Next »"
expect(page.current_url).to_not have_content "/track"
end

it 'should show "Back to Search" and "Start Over links"' do
it 'shows "Back to Search" and "Start Over links"' do
search_for 'Bod kyi naṅ chos ṅo sprod sñiṅ bsdus'
first('.index_title a').click
within '.pagination-search-widgets' do
Expand All @@ -33,7 +33,7 @@
end

context "navigating between search results using context pagination" do
it "should update the back to search link with the current search pagination context" do
it "updates the back to search link with the current search pagination context" do
search_for ''
first('.index_title a').click
10.times do
Expand Down
Loading

0 comments on commit b55c3ae

Please sign in to comment.