Sha256: 64a482254aff60c68d3c469ee28ad8da790d8112b51180212e5b026e138ab89f

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 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
          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
          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

4 entries across 4 versions & 1 rubygems

Version Path
rocketjob_mission_control-4.1.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-4.0.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-3.2.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-3.1.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb