Created
September 10, 2012 15:13
-
-
Save jurgens/3691421 to your computer and use it in GitHub Desktop.
thinking sphinx helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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