Skip to content

Instantly share code, notes, and snippets.

@jurgens
Created September 10, 2012 15:13
Show Gist options
  • Save jurgens/3691421 to your computer and use it in GitHub Desktop.
Save jurgens/3691421 to your computer and use it in GitHub Desktop.
thinking sphinx helpers
describe do
describe "Find pages", :sphinx do
before { Factory :page, site_ids: [Site.first.id], title: "first", hidden: false }
before { Factory :page, site_ids: [Site.last.id], title: "second", hidden: true }
before { ThinkingSphinx::Test.index; sleep 1 }
specify "should be able to search pages", :js do
search_for "first"
within ".narrow-col" do
page.should have_content "Text results (1)"
page.should have_content "first"
end
end
specify "should not be able to search for pagethat doesnt exist", :js do
search_for "ababagalamaga"
within ".narrow-col" do
page.should have_content "Text results (0)"
page.should_not have_content "second"
end
end
end
end
require 'thinking_sphinx/test'
ThinkingSphinx::Test.init
RSpec.configure do |config|
config.before(:all) do
ThinkingSphinx::Test.start
end
config.after(:suite) do
ThinkingSphinx::Test.stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment