Sha256: d1cef3b675fae7e8688bdbbdc6fa2131b5769d48adb263ab3c162c6230965840

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 '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 'fa-hourglass-o 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-3.0.3 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-3.0.2 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-3.0.1 test/helpers/rocket_job_mission_control/servers_helper_test.rb
rocketjob_mission_control-3.0.0 test/helpers/rocket_job_mission_control/servers_helper_test.rb