spec/pursuit/search_options_spec.rb in pursuit-0.3.0 vs spec/pursuit/search_options_spec.rb in pursuit-0.3.1

- old
+ new

@@ -102,15 +102,24 @@ it 'is expected to allow unkeyed searching by default' do attribute expect(search_options.attributes[:description].unkeyed).to eq(true) end - it 'is expected to use the matching table column node builder by default' do + it 'is expected to query the #term_name attribute' do attribute expect(search_options.attributes[:description].block.call).to eq(Product.arel_table[:description]) end + context 'when passing the attribute name to search' do + subject(:attribute) { search_options.attribute(:desc, :description) } + + it 'is expected to query the #attribute_name attribute' do + attribute + expect(search_options.attributes[:desc].block.call).to eq(Product.arel_table[:description]) + end + end + context 'when passing :keyed eq false' do subject(:attribute) { search_options.attribute(:description, keyed: false) } it 'is expected to disallow keyed searching' do attribute @@ -128,10 +137,10 @@ end context 'when passing a block' do subject(:attribute) { search_options.attribute(:description, &title_length_node_builder) } - it 'is expected to use the custom node builder' do + it 'is expected to query the result of the passed block' do attribute expect(search_options.attributes[:description].block).to eq(title_length_node_builder) end end end