-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0e55d5f
commit 51b6064
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
spec/components/blacklight/facet_field_pagination_component_spec.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,27 @@ | ||
# frozen_string_literal: true | ||
require 'rails_helper' | ||
|
||
RSpec.describe Blacklight::FacetFieldPaginationComponent, type: :component do | ||
let(:facet_field) { double('facet_field') } | ||
let(:total_unique_facets) { 42 } | ||
|
||
describe '#initialize' do | ||
context 'when total_unique_facets is provided' do | ||
it 'sets the facet_field and total_unique_facets attributes' do | ||
component = Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field, total_unique_facets: total_unique_facets) | ||
|
||
expect(component.facet_field).to eq(facet_field) | ||
expect(component.total_unique_facets).to eq(total_unique_facets) | ||
end | ||
end | ||
|
||
context 'when total_unique_facets is not provided' do | ||
it 'sets the total_unique_facets attribute to nil' do | ||
component = Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field) | ||
|
||
expect(component.facet_field).to eq(facet_field) | ||
expect(component.total_unique_facets).to be_nil | ||
end | ||
end | ||
end | ||
end |