Skip to content

Commit

Permalink
fixed test for travis (doesn't support neo4j clean-db)
Browse files Browse the repository at this point in the history
  • Loading branch information
elado committed Jul 7, 2012
1 parent 518a477 commit 16a61af
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

## v0.0.1

* initial release
* initial release
1 change: 1 addition & 0 deletions lib/neoid/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def neo_node

def neo_destroy
return unless neo_node
Neoid.db.remove_node_from_index(DEFAULT_FULLTEXT_SEARCH_INDEX_NAME, neo_node)
Neoid.db.remove_node_from_index(self.class.neo_index_name, neo_node)
neo_node.del
_reset_neo_representation
Expand Down
1 change: 0 additions & 1 deletion neoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rest-client'
s.add_development_dependency 'activerecord'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'database_cleaner'

s.add_runtime_dependency 'neography'
end
11 changes: 6 additions & 5 deletions spec/neoid/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
end

it "should index item on save" do
article = Article.create!(title: "Hello world", body: "Lorem ipsum dolor sit amet", year: 2012)

r = rand(1...10000000000)
article = Article.create!(title: "Hello world #{r}", body: "Lorem ipsum dolor sit amet", year: r)

[
"title:Hello",
"year:2012",
"title:Hello AND year:2012"
"title:#{r}",
"year:#{r}",
"title:#{r} AND year:#{r}"
].each { |q|
results = Neoid.db.find_node_index(Neoid::DEFAULT_FULLTEXT_SEARCH_INDEX_NAME, q)
results.should_not be_nil
Expand Down
17 changes: 2 additions & 15 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'active_record'
require 'neography'
require 'rest-client'
require 'database_cleaner'

uri = URI.parse(ENV["NEO4J_URL"] ? ENV["NEO4J_URL"] : ENV['TRAVIS'] ? "http://localhost:7474" : "http://localhost:7574")
$neo = Neography::Rest.new(uri.to_s)
Expand All @@ -23,19 +22,6 @@
RSpec.configure do |config|
config.mock_with :rspec

config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end

config.before(:all) do
dir = File.join(File.dirname(__FILE__), 'support/db')

Expand All @@ -54,7 +40,8 @@
end

config.before(:each) do
Neoid.clean_db(:yes_i_am_sure) unless ENV['TRAVIS']
Neoid.models.map(&:destroy_all)
# Neoid.clean_db(:yes_i_am_sure) unless ENV['TRAVIS']
Neoid.reset_cached_variables
end
end
Expand Down

0 comments on commit 16a61af

Please sign in to comment.