blob: 332acc1b08a239609df4bc1c1d896c5a868b40af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
require File.expand_path('../config/environment', __dir__)
require "rails/test_help"
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :minitest
with.library :rails
end
end
module ActiveSupport
class TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
fixtures :all
# Add more helper methods to be used by all tests here...
end
end
Faraday.new(url: "http://0.0.0.0:9200") do |builder|
builder.request :json
builder.adapter :test do |stub|
resp = {
"hits" => { "hits" => [] }
}
stub.get("/gitscm/doc/_search") { [200, {}, JSON.dump(resp)] }
stub.get("/gitscm/book/_search") { [200, {}, JSON.dump(resp)] }
stub.put("/gitscm/book/en---Title-1-Title-2") { [200, {}, "{}"] }
end
end
|