Sha256: dd9c5a193fd922c55421d19160b2d214638e2efa89a4ae8decb0d27afbcb30a6

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'
require "superstore/railties/controller_runtime"

class Superstore::Railties::ControllerRuntimeTest < MiniTest::Unit::TestCase
  class TestRuntime
    def self.log_process_action(payload)
      ['sweet']
    end

    def cleanup_view_runtime
      12
    end

    def append_info_to_payload(payload)
      payload[:foo] = 42
    end
  end

  class CassandraRuntime < TestRuntime
    include Superstore::Railties::ControllerRuntime
  end

  def test_cleanup_view_runtime
    runtime = CassandraRuntime.new
    Superstore::LogSubscriber.runtime = 10

    runtime.cleanup_view_runtime

    assert_equal 0, Superstore::LogSubscriber.runtime
  end

  def test_append_info_to_payload
    runtime = CassandraRuntime.new
    payload = {}
    runtime.append_info_to_payload(payload)

    assert_equal 42, payload[:foo]
    assert payload.key?(:cassandra_object_runtime)
  end

  def test_log_process_action
    payload = {cassandra_object_runtime: 12.3}
    messages = CassandraRuntime.log_process_action(payload)

    assert_equal 2, messages.size
    assert_equal "Superstore: 12.3ms", messages.last
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
superstore-1.1.4 test/unit/railties/controller_runtime_test.rb
superstore-1.1.3 test/unit/railties/controller_runtime_test.rb
superstore-1.1.2 test/unit/railties/controller_runtime_test.rb
superstore-1.1.1 test/unit/railties/controller_runtime_test.rb
superstore-1.1.0 test/unit/railties/controller_runtime_test.rb
superstore-1.0.12 test/unit/railties/controller_runtime_test.rb
superstore-1.0.11 test/unit/railties/controller_runtime_test.rb
superstore-1.0.10 test/unit/railties/controller_runtime_test.rb
superstore-1.0.9 test/unit/railties/controller_runtime_test.rb
superstore-1.0.8 test/unit/railties/controller_runtime_test.rb
superstore-1.0.7 test/unit/railties/controller_runtime_test.rb
superstore-1.0.6 test/unit/railties/controller_runtime_test.rb
superstore-1.0.5 test/unit/railties/controller_runtime_test.rb
superstore-1.0.4 test/unit/railties/controller_runtime_test.rb
superstore-1.0.3 test/unit/railties/controller_runtime_test.rb
superstore-1.0.2 test/unit/railties/controller_runtime_test.rb
superstore-1.0.0 test/unit/railties/controller_runtime_test.rb