Sha256: 7926a3eb6b0ad7994801e58c9c85a2522f3d9980335bb1d54f657dca417ee94b

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require "test_helper"

class Fluentd
  class AgentsControllerTest < ActionDispatch::IntegrationTest
    setup do
      @log = Object.new
      @agent = Object.new
      @fluentd = FactoryBot.build(:fluentd)
      stub(@agent).log { @log }
      stub(@fluentd).agent { @agent }
      stub(Fluentd).instance { @fluentd }


      user = FactoryBot.build(:user)
      post(sessions_path(session: { name: user.name, password: user.password }))


    end

    data("stop" => "stop",
         "start" => "start",
         "restart" => "restart",
         "reload" => "reload")
    test "the action succeed" do |action|
      mock(@agent).__send__(action) { true }
      put(__send__("#{action}_daemon_agent_path"))
    end

    data("stop" => "stop",
         "start" => "start",
         "restart" => "restart",
         "reload" => "reload")
    test "the action failure" do |action|
      mock(@agent).__send__(action) { false }
      mock(@log).tail(1) { ["dummylog"] } unless action == "stop"
      put(__send__("#{action}_daemon_agent_path"))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fluentd-ui-1.2.1 test/controllers/fluentd/agents_controller_test.rb
fluentd-ui-1.2.0 test/controllers/fluentd/agents_controller_test.rb
fluentd-ui-1.1.0 test/controllers/fluentd/agents_controller_test.rb
fluentd-ui-1.0.1 test/controllers/fluentd/agents_controller_test.rb
fluentd-ui-1.0.0 test/controllers/fluentd/agents_controller_test.rb