sunspot icon indicating copy to clipboard operation
sunspot copied to clipboard

unable to use .group on tests

Open wilkerlucio opened this issue 9 years ago • 1 comments

Hi,

In my code I have a search that uses the group feature, as in the following code:

search = Sunspot.search(Spree::Product, Catalog::Book) { group :format_description }
search.group(:format_description).groups.map(&:value)

This code works fine on development, but when I try to run a test with it I get:

  1) Spree::Product.all_format_descriptions return a distinct list with all the format descriptions
     Failure/Error: expect(Spree::Product.all_format_descriptions).to be_an_array_with(["Format A", "Format B"])
     NoMethodError:
       undefined method `group' for #<Sunspot::Rails::StubSessionProxy::Search:0x007ff976060870>
     # ./app/models/spree/product_decorator.rb:83:in `all_format_descriptions'
     # ./spec/models/spree/product_decorator_spec.rb:285:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:114:in `block (2 levels) in <top (required)>'

Is that a bug? How this is supposed to be handled?

Using sunspot 2.1.1

Thanks.

wilkerlucio avatar Dec 16 '14 18:12 wilkerlucio

:+1:

xjunior avatar Mar 02 '16 03:03 xjunior