diff --git a/spec/features/fluentd/setting/in_forward_spec.rb b/spec/features/fluentd/setting/in_forward_spec.rb index b5c6d12..b668623 100644 --- a/spec/features/fluentd/setting/in_forward_spec.rb +++ b/spec/features/fluentd/setting/in_forward_spec.rb @@ -1,23 +1,9 @@ require "spec_helper" -describe "in_forward" do - let(:exists_user) { build(:user) } - let(:daemon) { build(:fluentd, variant: "td-agent") } +describe "in_forward", stub: :daemon do let(:port) { "12345" } - #TODO: wanna DRY with shared_context - before do - Fluentd.stub(:instance).and_return(daemon) - Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true) - daemon.agent.config_write "" - - visit '/sessions/new' - within("form") do - fill_in 'session_name', :with => exists_user.name - fill_in 'session_password', :with => exists_user.password - end - click_button I18n.t("terms.sign_in") - end + before { login_with exists_user } it "Shown form with filled in td.*.* on match" do visit daemon_setting_in_forward_path diff --git a/spec/features/fluentd/setting/in_http_spec.rb b/spec/features/fluentd/setting/in_http_spec.rb index d890db6..d2b14ca 100644 --- a/spec/features/fluentd/setting/in_http_spec.rb +++ b/spec/features/fluentd/setting/in_http_spec.rb @@ -1,23 +1,9 @@ require "spec_helper" -describe "in_http" do - let(:exists_user) { build(:user) } - let(:daemon) { build(:fluentd, variant: "td-agent") } +describe "in_http", stub: :daemon do let(:port) { "12345" } - #TODO: wanna DRY with shared_context - before do - Fluentd.stub(:instance).and_return(daemon) - Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true) - daemon.agent.config_write "" - - visit '/sessions/new' - within("form") do - fill_in 'session_name', :with => exists_user.name - fill_in 'session_password', :with => exists_user.password - end - click_button I18n.t("terms.sign_in") - end + before { login_with exists_user } it "Shown form with filled in td.*.* on match" do visit daemon_setting_in_http_path diff --git a/spec/features/fluentd/setting/in_monitor_agent_spec.rb b/spec/features/fluentd/setting/in_monitor_agent_spec.rb index 60d35a7..01660f5 100644 --- a/spec/features/fluentd/setting/in_monitor_agent_spec.rb +++ b/spec/features/fluentd/setting/in_monitor_agent_spec.rb @@ -1,22 +1,9 @@ require "spec_helper" -describe "in_monitor_agent" do - let(:exists_user) { build(:user) } - let(:daemon) { build(:fluentd, variant: "td-agent") } +describe "in_monitor_agent", stub: :daemon do let(:port) { "12345" } - before do - Fluentd.stub(:instance).and_return(daemon) - Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true) - daemon.agent.config_write "" - - visit '/sessions/new' - within("form") do - fill_in 'session_name', :with => exists_user.name - fill_in 'session_password', :with => exists_user.password - end - click_button I18n.t("terms.sign_in") - end + before { login_with exists_user } it "Shown form with filled in td.*.* on match" do visit daemon_setting_in_monitor_agent_path diff --git a/spec/features/fluentd/setting/out_stdout_spec.rb b/spec/features/fluentd/setting/out_stdout_spec.rb index 3d27b0b..22550ae 100644 --- a/spec/features/fluentd/setting/out_stdout_spec.rb +++ b/spec/features/fluentd/setting/out_stdout_spec.rb @@ -1,22 +1,9 @@ require "spec_helper" -describe "out_stdout" do - let(:exists_user) { build(:user) } - let(:daemon) { build(:fluentd, variant: "td-agent") } +describe "out_stdout", stub: :daemon do let(:match) { "stdout.**" } - before do - Fluentd.stub(:instance).and_return(daemon) - Fluentd::Agent::TdAgent.any_instance.stub(:detached_command).and_return(true) - daemon.agent.config_write "" - - visit '/sessions/new' - within("form") do - fill_in 'session_name', :with => exists_user.name - fill_in 'session_password', :with => exists_user.password - end - click_button I18n.t("terms.sign_in") - end + before { login_with exists_user } it "Shown form with filled in td.*.* on match" do visit daemon_setting_out_stdout_path