From f6a9c4ac5eab664e28ab8ce03dae8042a765225c Mon Sep 17 00:00:00 2001 From: hassaku Date: Wed, 3 Dec 2014 14:38:35 +0900 Subject: [PATCH] Add feature spec for in_forward setting. --- .../fluentd/setting/in_forward_spec.rb | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 spec/features/fluentd/setting/in_forward_spec.rb diff --git a/spec/features/fluentd/setting/in_forward_spec.rb b/spec/features/fluentd/setting/in_forward_spec.rb new file mode 100644 index 0000000..b5c6d12 --- /dev/null +++ b/spec/features/fluentd/setting/in_forward_spec.rb @@ -0,0 +1,36 @@ +require "spec_helper" + +describe "in_forward" do + let(:exists_user) { build(:user) } + let(:daemon) { build(:fluentd, variant: "td-agent") } + 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 + + it "Shown form with filled in td.*.* on match" do + visit daemon_setting_in_forward_path + page.should have_css('input[name="fluentd_setting_in_forward[port]"]') + end + + it "Updated config after submit" do + daemon.agent.config.should_not include(port) + visit daemon_setting_in_forward_path + within('#new_fluentd_setting_in_forward') do + fill_in "Port", with: port + end + click_button I18n.t("fluentd.common.finish") + daemon.agent.config.should include(port) + end +end