Sha256: 09d801b9449e019c0602a4283c45ea3031c5b9171c4400475be8ee229d60205c

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe HomeController do
  
  before(:each) do
    Ratchetio.configure do |config|
      config.logger = logger_mock
    end
  end
    
  let(:logger_mock) { double("Rails.logger").as_null_object }

  describe "GET 'index'" do
    it "should be successful and report a message" do
      logger_mock.should_receive(:info).with('[Ratchet.io] Sending payload')
      get 'index'
      response.should be_success
    end
  end

  describe "GET 'report_exception'" do
    it "should raise a NameError and report an exception" do
      logger_mock.should_receive(:info).with('[Ratchet.io] Sending payload')

      get 'report_exception'
      response.should be_success
    end
  end

  # TODO need to figure out how to make a test request that uses enough of the middleware
  # that it invokes the ratchetio exception catcher. just plain "get 'some_url'" doesn't
  # seem to work.
  it "should report uncaught exceptions"
  
  after(:each) do
    Ratchetio.configure do |config|
      config.logger = ::Rails.logger
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratchetio-0.4.3 spec/controllers/home_controller_spec.rb