Sha256: 0965968ab4aa0e8f07699d584b3632d8c0809b15c7d7ee953e08efcc959a99dc

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 KB

Contents

# coding: utf-8
require 'rubygems'
require 'rails'
require 'json'
require 'active_support'
require 'action_pack'
require 'action_view'
require 'action_controller'
require 'action_view/template'

require 'rspec'
require 'world-flags'

# WorldFlags::Rails::Engine.add_view_ext

module ControllerTestHelpers

  def self.included(base)
    base.class_eval do
      
      include ActionView::Helpers,
              ActionView::Helpers::CaptureHelper,
              ActionView::Helpers::JavaScriptHelper
  
      # allow tabs.create to run by stubbing an output_buffer
      attr_accessor :output_buffer
      @output_buffer = ""
  
      # stub content_for for testing
      def content_for(name, content = nil, &block)
        # this doesn't exist, and causes errors
        @_content_for = {} unless defined? @_content_for
        # we've got to initialize this, so we can concat to it
        @_content_for[name] = '' if @_content_for[name].nil?
        # now the rest is the same as in rails
        content = capture(&block) if block_given?
        @_content_for[name] << content if content
        @_content_for[name] unless content
      end
    
    end
  end

end

RSpec.configure do |c|
  # c.filter_run :focus => true
  # c.run_all_when_everything_filtered = true
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
world-flags-0.3.4 spec/spec_helper.rb
world-flags-0.3.2.2 spec/spec_helper.rb
world-flags-0.3.2.1 spec/spec_helper.rb
world-flags-0.3.2 spec/spec_helper.rb
world-flags-0.3.1 spec/spec_helper.rb
world-flags-0.3.0 spec/spec_helper.rb
world-flags-0.2.7 spec/spec_helper.rb
world-flags-0.2.4 spec/spec_helper.rb
world-flags-0.2.3 spec/spec_helper.rb
world-flags-0.2.2 spec/spec_helper.rb
world-flags-0.2.1 spec/spec_helper.rb
world-flags-0.2.0 spec/spec_helper.rb
world-flags-0.1.5 spec/spec_helper.rb
world-flags-0.1.4 spec/spec_helper.rb