Skip to content

Incomplete documentation #6

arashm opened this Issue Dec 21, 2012 · 2 comments

2 participants

arashm commented Dec 21, 2012

I can't get the Gem work with my app. I'm using rspec with spork and webmock. here's my spec_helper.rb:

Spork.prefork do
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'
  require 'rspec/autorun'
  require 'sunspot_test/rspec'
  require 'webmock/rspec'
  # Allow local connections!
  WebMock.disable_net_connect!(:allow_localhost => true)

  # Sunspot test configs
  $original_sunspot_session = Sunspot.session


  RSpec.configure do |config|
    # Sunspot test configs
    config.before do
      Sunspot.session =$original_sunspot_session)

    config.before :each, :solr => true do
      Sunspot.session = $original_sunspot_session

and this is my simple test:

it 'posts the story and put it on queue', focus: true, :solr => true do
  fill_in "story_title", with: 'newpost'
  fill_in "story_content", with: 'new content'
  click_button "success"
  page.should have_content("successful")
  visit root_path
  page.should have_content(title)

the page gets it's content from a sunspot search block inside index action. Page does have the content "successful", but the post title is not available(even with save_and_open_page the post is not there).

If I put the Sunspot::Rails::Tester.start_original_sunspot_session outside rspec.configure and after spork block, I'll get the same error. if I put it before spork block, I get an exception from WebMock. what is the problem? BTW, I'm using Rails 3.2.9 and sunspot 1.3.3.


@arashm Do you still need help with this? And if so, is it something you can still provide feedback on?


Closing for now, please reopen if you can shead any more light on the problem.

@krisleech krisleech closed this Apr 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.