Sha256: 2703577d02707e9a441fc39f5a3b93b981775b4e4e95e6da7acf7263ca9657b1

Contents?: true

Size: 1.84 KB

Versions: 13

Compression:

Stored size: 1.84 KB

Contents

require_relative "../../test_helper"

module RocketJobMissionControl
  ServersHelper.include(RocketJobMissionControl::ApplicationHelper)

  class ServersHelperTest < ActionView::TestCase
    describe ServersHelper do
      describe "#server_card_class" do
        describe "when the server is running" do
          let(:server) do
            server = RocketJob::Server.new
            server.started
            server.build_heartbeat(updated_at: Time.now, workers: 0)
            server
          end

          it "returns the correct class" do
            assert_equal "callout-success", server_card_class(server)
          end
        end

        describe "when the server is a zombie" do
          let(:server) do
            server = RocketJob::Server.new
            server.started
            server.build_heartbeat(updated_at: 1.hour.ago, workers: 0)
            server
          end

          it "returns the correct class" do
            assert_equal "callout-zombie", server_card_class(server)
          end
        end
      end

      describe "#server_icon" do
        describe "when the server is running" do
          let(:server) do
            server = RocketJob::Server.new
            server.started
            server.build_heartbeat(updated_at: Time.now, workers: 0)
            server
          end

          it "returns the correct class" do
            assert_equal "fas fa-play running", server_icon(server)
          end
        end

        describe "when the server is a zombie" do
          let(:server) do
            server = RocketJob::Server.new
            server.started
            server.build_heartbeat(updated_at: 1.hour.ago, workers: 0)
            server
          end

          it "returns the correct class" do
            assert_equal "fas fa-hourglass zombie", server_icon(server)
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rocketjob_mission_control-6.1.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.7 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.6 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.5 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.4 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.3 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.2 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.1 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-6.0.0.beta test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-5.0.1 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-5.0.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-5.0.0.beta1 test/helpers/rocket_job_mission_control/servers_helper_test.rb