Sha256: c26cd8b365fff49b98c696aa0b1d995b196af9e1d65d3b694b249eae9bb46de3

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require File.join(File.expand_path('../../test_helper', __FILE__))

class WolverineIntegrationTest < MiniTest::Unit::TestCase

  CONTENT = File.read(File.expand_path('../lua/util/mexists.lua', __FILE__))

  def mock_redis
    stub.tap do |redis|
      redis.expects(:evalsha).
        with('fe24f4dd4ba7881608cca4b846f009195e06d79a', :a, :b).
        raises("NOSCRIPT").once
      redis.expects(:eval).
        with(CONTENT, :a, :b).
        returns([1, 0]).once
    end
  end

  def test_everything
    Wolverine.config.redis = mock_redis
    Wolverine.config.script_path = Pathname.new(File.expand_path('../lua', __FILE__))

    assert_equal [1, 0], Wolverine.util.mexists(:a, :b)
    assert Wolverine.methods.include?(:util)
  end

  def test_everything_instantiated
    script_path = Pathname.new(File.expand_path('../lua', __FILE__))
    config = Wolverine::Configuration.new(mock_redis, script_path)

    wolverine = Wolverine.new(config)
    assert_equal [1, 0], wolverine.util.mexists(:a, :b)
    assert wolverine.methods.include?(:util)
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wolverine-0.3.5 test/integration/wolverine_integration_test.rb
wolverine-0.3.4 test/integration/wolverine_integration_test.rb
wolverine-0.3.3 test/integration/wolverine_integration_test.rb
wolverine-0.3.2 test/integration/wolverine_integration_test.rb
wolverine-0.3.1 test/integration/wolverine_integration_test.rb
wolverine-0.2.7 test/integration/wolverine_integration_test.rb
wolverine-0.2.6 test/integration/wolverine_integration_test.rb