This repository has been archived by the owner on Jun 30, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added infrastructure for integration tests
- Loading branch information
Showing
7 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
{"title" : "One", "tags" : ["ruby"]} |
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
{"title" : "Two", "tags" : ["ruby", "python"]} |
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
{"title" : "Three", "tags" : ["java"]} |
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
{"title" : "Four", "tags" : ["erlang"]} |
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
{"title" : "Five", "tags" : ["javascript", "java"]} |
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,9 +1,40 @@ | |||
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) | |||
|
|||
require 'rubygems' | require 'rubygems' | ||
require 'test/unit' | require 'test/unit' | ||
require 'shoulda' | require 'shoulda' | ||
require 'mocha' | require 'mocha' | ||
require 'turn' unless ENV["TM_FILEPATH"] | require 'turn' unless ENV["TM_FILEPATH"] | ||
require 'pathname' | |||
|
|
||
require 'slingshot' | require 'slingshot' | ||
|
|||
class Test::Unit::TestCase | |||
|
|||
def fixtures_path | |||
Pathname( File.expand_path( 'fixtures', File.dirname(__FILE__) ) ) | |||
end | |||
|
|||
def fixture_file(path) | |||
File.read File.expand_path( path, fixtures_path ) | |||
end | |||
|
|||
end | |||
|
|||
module Test::Integration | |||
URL = "http://localhost:9200" | |||
|
|||
def setup | |||
::RestClient.delete "#{URL}/articles-test" rescue nil | |||
::RestClient.post "#{URL}/articles-test", '' | |||
fixtures_path.join('articles').entries.each do |f| | |||
filename = f.to_s | |||
next if filename =~ /^\./ | |||
::RestClient.put "#{URL}/articles-test/article/#{File.basename(filename, '.*')}", | |||
fixtures_path.join('articles').join(f).read | |||
end | |||
::RestClient.post "#{URL}/articles-test/_refresh", '' | |||
end | |||
|
|||
def teardown | |||
::RestClient.delete "#{URL}/articles-test" rescue nil | |||
end | |||
end |