Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ AllCops:
NewCops: disable
TargetRubyVersion: 3.2.2
DisplayCopNames: true
SuggestExtensions: false
Exclude:
# NOTE: When we run knapsack's rubocop, we don't want to check the submodule
# for Hyku. We'll assume it's okay and has it's own policing policies.
- "hyrax-webapp/**/*"
- "gems/**/*"

Metrics/BlockLength:
AllowedMethods: ['included', 'describe', 'it', 'context']
Expand Down
2 changes: 2 additions & 0 deletions hyku_knapsack.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ Gem::Specification.new do |spec|
end

spec.add_dependency "rails", ">= 5.2.0"

spec.add_development_dependency "rubocop-rake"
end
3 changes: 2 additions & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
# TODO is this needed?
config.include HykuKnapsack::Engine.routes.url_helpers
config.include Capybara::DSL
config.include Fixtures::FixtureFileUpload
# Only include Fixtures::FixtureFileUpload if it's defined (from hyrax-webapp)
config.include Fixtures::FixtureFileUpload if defined?(Fixtures::FixtureFileUpload)
end
24 changes: 24 additions & 0 deletions spec/support/knapsack_view_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

# This shared context ensures that view specs in the knapsack correctly
# prioritize knapsack views over hyrax-webapp views.
#
# Usage:
# RSpec.describe 'path/to/view.html.erb', type: :view do
# include_context 'with knapsack view paths'
# # ... your spec code
# end
#
RSpec.shared_context 'with knapsack view paths' do
before do
# Prepend the knapsack view paths so that views in the knapsack
# take precedence over views in hyrax-webapp.
# This mimics what happens in production via the Engine's after_initialize hook.
view.view_paths.unshift(HykuKnapsack::Engine.root.join('app', 'views'))
end
end

# Automatically include this context for all view specs in the knapsack
RSpec.configure do |config|
config.include_context 'with knapsack view paths', type: :view
end
Loading