Refactor feature specs for settings.

This commit is contained in:
hassaku 2014-12-03 15:30:31 +09:00
parent f6a9c4ac5e
commit 3be2bcb226
4 changed files with 8 additions and 62 deletions

View File

@ -1,23 +1,9 @@
require "spec_helper" require "spec_helper"
describe "in_forward" do describe "in_forward", stub: :daemon do
let(:exists_user) { build(:user) }
let(:daemon) { build(:fluentd, variant: "td-agent") }
let(:port) { "12345" } let(:port) { "12345" }
#TODO: wanna DRY with shared_context before { login_with exists_user }
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
it "Shown form with filled in td.*.* on match" do it "Shown form with filled in td.*.* on match" do
visit daemon_setting_in_forward_path visit daemon_setting_in_forward_path

View File

@ -1,23 +1,9 @@
require "spec_helper" require "spec_helper"
describe "in_http" do describe "in_http", stub: :daemon do
let(:exists_user) { build(:user) }
let(:daemon) { build(:fluentd, variant: "td-agent") }
let(:port) { "12345" } let(:port) { "12345" }
#TODO: wanna DRY with shared_context before { login_with exists_user }
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
it "Shown form with filled in td.*.* on match" do it "Shown form with filled in td.*.* on match" do
visit daemon_setting_in_http_path visit daemon_setting_in_http_path

View File

@ -1,22 +1,9 @@
require "spec_helper" require "spec_helper"
describe "in_monitor_agent" do describe "in_monitor_agent", stub: :daemon do
let(:exists_user) { build(:user) }
let(:daemon) { build(:fluentd, variant: "td-agent") }
let(:port) { "12345" } let(:port) { "12345" }
before do before { login_with exists_user }
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
it "Shown form with filled in td.*.* on match" do it "Shown form with filled in td.*.* on match" do
visit daemon_setting_in_monitor_agent_path visit daemon_setting_in_monitor_agent_path

View File

@ -1,22 +1,9 @@
require "spec_helper" require "spec_helper"
describe "out_stdout" do describe "out_stdout", stub: :daemon do
let(:exists_user) { build(:user) }
let(:daemon) { build(:fluentd, variant: "td-agent") }
let(:match) { "stdout.**" } let(:match) { "stdout.**" }
before do before { login_with exists_user }
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
it "Shown form with filled in td.*.* on match" do it "Shown form with filled in td.*.* on match" do
visit daemon_setting_out_stdout_path visit daemon_setting_out_stdout_path