Sha256: c0cf1b5ecb0358307e800f7e2ee5b898ebf3ed99635d0ea3fe49e7403eddff17

Contents?: true

Size: 874 Bytes

Versions: 6

Compression:

Stored size: 874 Bytes

Contents

require 'spec_helper'
require 'stringio'

describe 'log note' do

  class ApplicationController < ActionController::Base
  end

  controller do
    def index
      Rails.logger.error 'foo'
      Rails.logger.warn 'bar'
      render :text => '<html><head></head><body></body></html>', :content_type => 'text/html'
    end
  end

  def page
    Capybara::Node::Simple.new(response.body)
  end

  before :all do
    Footnotes.enabled = true
  end

  after :all do
    Footnotes.enabled = false
  end

  before do
    @original_logger = Rails.logger
    Rails.logger = Logger.new(StringIO.new)
  end

  after do
    Rails.logger = @original_logger
  end

  it 'Includes the log in the response' do
    get :index
    log_debug = first('fieldset#log_debug_info div', :visible => false)
    log_debug.should have_content('foo')
    log_debug.should have_content('bar')
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails-footnotes-4.1.2 spec/controllers/log_note_controller_spec.rb
rails-footnotes-4.1.1 spec/controllers/log_note_controller_spec.rb
rails-footnotes-4.1.0 spec/controllers/log_note_controller_spec.rb
rails-footnotes-4.0.2 spec/controllers/log_note_controller_spec.rb
rails-footnotes-4.0.1 spec/controllers/log_note_controller_spec.rb
rails-footnotes-4.0.0 spec/controllers/log_note_controller_spec.rb