Sha256: 5ec87aa14cf1306f6a2bcab5519108be9959a06703ab3cb5c8f46657bcfb29c8

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require "test_helper"

describe "Game time conversion" do

  before { @game_time = QuakeliveApi::GameTime.new(string) }

  describe "parses periods without days" do
    let(:string) { "Ranked Time: 21:50 Unranked Time: 04:54" }

    describe "ranked time" do
      subject { @game_time.ranked }

      its(:days)    { must_equal 0 }
      its(:hours)   { must_equal 0 }
      its(:minutes) { must_equal 21 }
      its(:seconds) { must_equal 50 }
    end

    describe "unranked time" do
      subject { @game_time.unranked }

      its(:days)    { must_equal 0 }
      its(:hours)   { must_equal 0 }
      its(:minutes) { must_equal 4 }
      its(:seconds) { must_equal 54 }
    end
  end

  describe "parses periods with days" do
    let(:string) { "Ranked Time: 50.06:18:30 Unranked Time: 02:31:02" }

    describe "ranked time" do
      subject { @game_time.ranked }

      its(:days)    { must_equal 50 }
      its(:hours)   { must_equal 6 }
      its(:minutes) { must_equal 18 }
      its(:seconds) { must_equal 30 }
    end

    describe "unranked time" do
      subject { @game_time.unranked }

      its(:days)    { must_equal 0 }
      its(:hours)   { must_equal 2 }
      its(:minutes) { must_equal 31 }
      its(:seconds) { must_equal 02 }
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
quakelive_api-0.1.2 test/quakelive_api/game_time_test.rb
quakelive_api-0.1.1 test/quakelive_api/game_time_test.rb
quakelive_api-0.1.0 test/quakelive_api/game_time_test.rb
quakelive_api-0.0.1 test/quakelive_api/game_time_test.rb