mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-08 07:17:07 +02:00
Extract shared_context
This commit is contained in:
parent
fbb8b658bb
commit
c44ecb5ac7
@ -1,16 +1,11 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_elasticsearch" do
|
||||
describe "out_elasticsearch", stub: :daemon do
|
||||
let(:exists_user) { build(:user) }
|
||||
let(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
let(:match) { "test.out_elasticsearch.#{Time.now.to_i}.*" }
|
||||
let(:match) { "test.out_forward.#{Time.now.to_i}.*" }
|
||||
let(:location) { daemon_setting_out_elasticsearch_path }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
daemon.agent.config_write ""
|
||||
|
||||
login_with exists_user
|
||||
end
|
||||
|
||||
|
@ -1,15 +1,10 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_forward" do
|
||||
describe "out_forward", stub: :daemon do
|
||||
let(:exists_user) { build(:user) }
|
||||
let(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
let(:match) { "test.out_forward.#{Time.now.to_i}.*" }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
daemon.agent.config_write ""
|
||||
|
||||
login_with exists_user
|
||||
end
|
||||
|
||||
|
@ -1,15 +1,10 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "out_td" do
|
||||
describe "out_td", stub: :daemon do
|
||||
let(:exists_user) { build(:user) }
|
||||
let(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
let(:api_key) { "dummydummy" }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
daemon.agent.config_write ""
|
||||
|
||||
login_with exists_user
|
||||
end
|
||||
|
||||
|
@ -1,13 +1,9 @@
|
||||
require "spec_helper"
|
||||
|
||||
describe "source_and_output", js: true do
|
||||
describe "source_and_output", js: true, stub: :daemon do
|
||||
let(:exists_user) { build(:user) }
|
||||
let(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
|
||||
login_with exists_user
|
||||
end
|
||||
|
||||
|
@ -35,6 +35,7 @@ RSpec.configure do |config|
|
||||
config.include FactoryGirl::Syntax::Methods
|
||||
config.include LoginMacro
|
||||
config.include JavascriptMacro
|
||||
config.include StubDaemon
|
||||
|
||||
# If true, the base class of anonymous controllers will be inferred
|
||||
# automatically. This will be the default behavior in future versions of
|
||||
|
12
spec/support/stub_daemon.rb
Normal file
12
spec/support/stub_daemon.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module StubDaemon
|
||||
shared_context 'stub daemon', stub: :daemon do
|
||||
let!(:exists_user) { build(:user) }
|
||||
let!(:daemon) { build(:fluentd, variant: "td-agent") }
|
||||
|
||||
before do
|
||||
Fluentd.stub(:instance).and_return(daemon)
|
||||
Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true)
|
||||
daemon.agent.config_write ""
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user