Sha256: 965be3649307e001278fad44af53d9c8d612a37a715980b5afc7a2f0135a86d8

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper.rb")
require "glowworm"

class EmTest < Scope::TestCase
  context "with an ecology and mocked server" do
    setup do
      Ecology.reset

      set_up_ecology <<ECOLOGY_TEXT
{
  "application": "foo_app",
  "features": {
    "server": "http://fake-server.com",
    "refresh": 300,
    "timeout": 5
  }
}
ECOLOGY_TEXT

      # Turn off loud logging for tests
      Glowworm.termite_logger = stub("fake termite logger", :debug => nil, :info => nil, :warn => nil)

      # @response = mock "HTTP response"
      # @response.stubs(:headers).returns({ "last-modified" => "" })
      # @response.stubs(:code).returns(200)
      # HTTParty.stubs(:get).returns(@response)
      Glowworm.stubs(:update_cache)
    end

    should "call the non-em-safe version of update cache when not in Glowworm.em" do
      Glowworm.expects(:_update_cache_in_foreground_)
      Glowworm.no_bg
    end

    should "call the em-safe version of update cache when in Glowworm.em" do
      EM.expects(:synchrony)
      Glowworm.stubs(:require_em)
      Glowworm.em
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glowworm-0.3.0 test/units/em_test.rb