-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
169 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,8 @@ Gemfile.lock | |
test/dummy/log | ||
*.sqlite3 | ||
.rvmrc | ||
spec/internal | ||
tmp | ||
coverage | ||
pkg | ||
.bundle |
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,20 +1,29 @@ | ||
source "http://rubygems.org" | ||
|
||
# Declare your gem's dependencies in blacklight-hierarchy-facets.gemspec. | ||
# Bundler will treat runtime dependencies like base dependencies, and | ||
# development dependencies will be added by default to the :development group. | ||
gemspec | ||
|
||
# jquery-rails is used by the dummy application | ||
gem "jquery-rails" | ||
|
||
# Declare any dependencies that are still in development here instead of in | ||
# your gemspec. These might include edge Rails or gems from your path or | ||
# Git. Remember to move these dependencies to your gemspec before releasing | ||
# your gem to rubygems.org. | ||
|
||
# To use debugger | ||
# gem 'ruby-debug' | ||
# sprockets 2.11.0 required by blacklight test app generated by engine_cart | ||
# If we don't specify it here, we'll end up with a conflict with version in Gemfile.lock | ||
gem 'sprockets', '2.11.0' | ||
|
||
# sass 3.2.0 required by blacklight test app generated by engine_cart | ||
# If we don't specify it here, we'll end up with a conflict with version in Gemfile.lock | ||
gem 'sass', '~> 3.2.0' | ||
gem 'bootstrap-sass', ">= 3.1.1.1" | ||
|
||
# load local rails test instance Gemfile (engine cart adds this automagically) | ||
#file = File.expand_path("Gemfile", ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path("../spec/internal", __FILE__)) | ||
#if File.exists?(file) | ||
# puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` | ||
# instance_eval File.read(file) | ||
#end | ||
|
||
gem 'sqlite3' | ||
gem 'fakeweb' | ||
if File.exists?('spec/test_app_templates/Gemfile.extra') | ||
eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra' | ||
end |
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,6 +1,7 @@ | ||
require 'blacklight/hierarchy/engine' | ||
require 'blacklight/hierarchy/version' | ||
|
||
module Blacklight | ||
module Hierarchy | ||
require 'blacklight/hierarchy/engine' | ||
end | ||
end |
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,3 +1,5 @@ | ||
require 'blacklight' | ||
|
||
module Blacklight | ||
module Hierarchy | ||
class Engine < Rails::Engine | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'rails/generators' | ||
|
||
module BlacklightHierarchy | ||
class Install < Rails::Generators::Base | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
require 'spec_helper' | ||
|
||
describe "Facet Hierarchy", :vcr => {:cassette_name => "solr"} do | ||
|
||
before(:each) do | ||
CatalogController.blacklight_config = Blacklight::Configuration.new | ||
CatalogController.configure_blacklight do |config| | ||
# config.index.title_field = 'title_display' | ||
# config.default_solr_params = { | ||
# :rows => 10 | ||
# } | ||
config.add_facet_field 'tag_facet', :label => 'Tag', :partial => 'blacklight/hierarchy/facet_hierarchy' | ||
config.facet_display = { | ||
:hierarchy => { | ||
'tag' => [nil] | ||
} | ||
} | ||
config.default_solr_params[:'facet.field'] = config.facet_fields.keys | ||
end | ||
end | ||
|
||
it 'uses the solr cassette' do | ||
expect(VCR.current_cassette.name).to eql "solr" | ||
end | ||
|
||
it "should display the hierarchy" do | ||
visit '/' | ||
#p page.source | ||
expect(page).to have_selector('li.h-node', :text => 'a') | ||
expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'b') | ||
expect(page).to have_selector('li.h-node li.h-leaf', :text => 'c (30)') | ||
expect(page).to have_selector('li.h-node li.h-leaf', :text => 'd (25)') | ||
expect(page).to have_selector('li.h-node > ul > li.h-node', :text => 'c') | ||
expect(page).to have_selector('li.h-node li.h-leaf', :text => 'd (5)') | ||
expect(page).to have_selector('.facet-hierarchy > li.h-leaf', :text => 'n (1)') | ||
expect(page).to have_selector('li.h-node li.h-leaf', :text => 'q (25)') | ||
expect(page).to have_selector('li.h-node li.h-leaf', :text => 'x (5)') | ||
end | ||
|
||
it "should properly link the hierarchy" do | ||
visit '/' | ||
#p page.all(:css, 'li.h-leaf a') | ||
expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(catalog_index_path('f' => { 'tag_facet' => ['n'] })) | ||
expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(catalog_index_path('f' => { 'tag_facet' => ['a:b:c'] })) | ||
expect(page.all(:css, 'li.h-leaf a').map { |a| a[:href].to_s }).to include(catalog_index_path('f' => { 'tag_facet' => ['x:y'] })) | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
group :test do | ||
gem 'generator_spec' | ||
end | ||
|
||
gem 'blacklight' |
25 changes: 25 additions & 0 deletions
25
spec/test_app_templates/lib/generators/test_app_generator.rb
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'rails/generators' | ||
|
||
class TestAppGenerator < Rails::Generators::Base | ||
source_root File.expand_path("../../../../test_app_templates", __FILE__) | ||
|
||
# This is only necessary for Rails 3 | ||
def remove_index | ||
remove_file "public/index.html" | ||
end | ||
|
||
def run_blacklight_generator | ||
say_status("warning", "GENERATING BL", :yellow) | ||
|
||
Bundler.with_clean_env do | ||
run "bundle install" | ||
end | ||
|
||
generate 'blacklight:install' | ||
end | ||
|
||
def run_hierarchy_install | ||
generate 'blacklight_hierarchy:install' | ||
end | ||
|
||
end |