Sha256: d6511e91224bcdfb008895eaecc500a35b93ea221ac2178e5a39e491debe986b

Contents?: true

Size: 773 Bytes

Versions: 6

Compression:

Stored size: 773 Bytes

Contents

require 'spec_helper'

class DummyServer < Goliath::API

end

describe "with_api" do
 let(:err) { Proc.new { fail "API request failed" } }

  it "should log in file if requested" do
    with_api(DummyServer, :log_file => "test.log") do |api|
      get_request({},err)
    end
    File.exist?("test.log").should be_true
    File.unlink("test.log")
  end

  it "should log on console if requested" do
    with_api(DummyServer, {:log_stdout => true }) do |api|
      api.logger.outputters.select {|o| o.is_a? Log4r::StdoutOutputter}.should_not be_empty
      EM.stop
    end
  end

  it "should be verbose if asked" do
    with_api(DummyServer, {:verbose => true, :log_stdout => true }) do |api|
      api.logger.level.should == Log4r::DEBUG
      EM.stop
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
goliath-1.0.4 spec/integration/test_helper_spec.rb
goliath-1.0.3 spec/integration/test_helper_spec.rb
goliath-1.0.2 spec/integration/test_helper_spec.rb
goliath-1.0.1 spec/integration/test_helper_spec.rb
goliath-1.0.0 spec/integration/test_helper_spec.rb
goliath-1.0.0.beta.1 spec/integration/test_helper_spec.rb