Skip to content

Commit a3ea713

Browse files
authored
Merge pull request #43 from projectblacklight/use_kwargs
Use kwargs to create the search_builder
2 parents 49d2083 + 3974801 commit a3ea713

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

lib/blacklight/access_controls/catalog.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def enforce_show_permissions(_opts = {})
1818

1919
# This will work for BL 6, but will need to move to SearchService in BL 7
2020
def search_builder
21-
Blacklight::AccessControls::SearchBuilder.new(self, current_ability)
21+
Blacklight::AccessControls::SearchBuilder.new(self, ability: current_ability)
2222
end
2323
end
2424
end

spec/unit/catalog_spec.rb

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

3-
describe Blacklight::AccessControls::Catalog do
3+
RSpec.describe Blacklight::AccessControls::Catalog do
44
let(:controller) { CatalogController.new }
55

66
describe '#enforce_show_permissions' do
7-
subject { controller.send(:enforce_show_permissions) }
7+
subject { controller.enforce_show_permissions }
88

99
let(:params) { { id: doc.id } }
1010

@@ -38,4 +38,16 @@
3838
end
3939
end
4040
end
41+
42+
describe '#search_builder' do
43+
subject { controller.search_builder }
44+
45+
before do
46+
allow(controller).to receive(:current_ability).and_return(instance_double(Ability))
47+
end
48+
49+
it 'creates a search_builder' do
50+
expect(subject).to be_kind_of Blacklight::AccessControls::SearchBuilder
51+
end
52+
end
4153
end

0 commit comments

Comments
 (0)