Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Incomplete documentation #6

Closed
arashm opened this Issue · 2 comments

2 participants

@arashm

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
  Sunspot::Rails::Tester.start_original_sunspot_session

  ....

  RSpec.configure do |config|
    # Sunspot test configs
    config.before do
      Sunspot.session = Sunspot::Rails::StubSessionProxy.new($original_sunspot_session)
    end

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

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)
end

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.

@krisleech
Collaborator

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

@krisleech
Collaborator

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

@krisleech krisleech closed this
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.