-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move has_search_parameters? into Blacklight::Catalog
This is a convenient method to use in a custom blacklight implementation. see projectblacklight/spotlight@5e817b9#diff-7ef82825d38ed0d7271a7cc87c280e3cR16
- Loading branch information
Showing
5 changed files
with
59 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,38 @@ | ||
require 'spec_helper' | ||
|
||
describe "catalog/index.html.erb" do | ||
it "should render the sidebar and content panes" do | ||
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new) | ||
render | ||
expect(rendered).to match /id="sidebar"/ | ||
expect(rendered).to match /id="content"/ | ||
end | ||
|
||
it "should render the search_sidebar partial " do | ||
stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content" | ||
describe "with no search parameters" do | ||
before do | ||
view.stub(:has_search_parameters?).and_return(false) | ||
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new) | ||
end | ||
it "should render the sidebar and content panes" do | ||
render | ||
expect(rendered).to match /id="sidebar"/ | ||
expect(rendered).to match /id="content"/ | ||
end | ||
|
||
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new) | ||
render | ||
expect(rendered).to match /sidebar_content/ | ||
it "should render the search_sidebar partial " do | ||
stub_template "catalog/_search_sidebar.html.erb" => "sidebar_content" | ||
render | ||
expect(rendered).to match /sidebar_content/ | ||
end | ||
end | ||
|
||
it "should render the search_header partial " do | ||
stub_template "catalog/_results_pagination.html.erb" => "" | ||
stub_template "catalog/_search_header.html.erb" => "header_content" | ||
describe "with search parameters" do | ||
before do | ||
view.stub(:has_search_parameters?).and_return(true) | ||
stub_template "catalog/_results_pagination.html.erb" => "" | ||
stub_template "catalog/_search_header.html.erb" => "header_content" | ||
|
||
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new) | ||
view.stub(:has_search_parameters?).and_return(true) | ||
view.stub(:render_opensearch_response_metadata).and_return("") | ||
assign(:response, double(:empty? => true)) | ||
render | ||
expect(rendered).to match /header_content/ | ||
view.stub(:blacklight_config).and_return(Blacklight::Configuration.new) | ||
view.stub(:render_opensearch_response_metadata).and_return("") | ||
assign(:response, double(:empty? => true)) | ||
end | ||
it "should render the search_header partial " do | ||
render | ||
expect(rendered).to match /header_content/ | ||
end | ||
end | ||
end | ||
end |