Sha256: aba41e99773483224f0b15f287e53c89ea7096f60862bf7ac504b14c1e3451d4

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

require 'test/unit'
require 'test/unit/testcase'
require 'rubygems'
require 'shoulda'
require 'mocha'
require 'activesupport'
require 'actionpack'
require 'action_view'
require 'action_controller'
require 'action_controller/test_process'

begin
  require 'redgreen/unicode'
rescue
  require 'redgreen'
end

[['..', 'lib'], ['lib']].each do |lib_dir|
  lib_path = File.expand_path(File.join(File.dirname(__FILE__), *lib_dir))
  $: << lib_path unless $:.include?(lib_path)
end

require 'xebec'

Test::Unit::TestCase.class_eval do
  include ActionController::Assertions::SelectorAssertions
  
  def assert_select_from(text, *args, &block)
    @selected = HTML::Document.new(text).root.children
    assert_select(*args, &block)
  end
  
  def new_nav_bar_helper
    ActionView::Base.new.tap do |helper|
      helper.extend Xebec::NavBarHelper
      helper.request = ActionController::TestRequest.new
      helper.stubs(:current_page?).returns(false)
    end
  end
  
  def clear_translations!
    I18n.reload!
  end

  def define_translation(key, value)
    hash = key.to_s.split('.').reverse.inject(value) do |value, key_part|
      { key_part.to_sym => value }
    end
    I18n.backend.send :merge_translations, I18n.locale, hash
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
xebec-2.5.2 test/test_helper.rb
xebec-2.5.1 test/test_helper.rb
xebec-2.5.0 test/test_helper.rb
xebec-2.4.0 test/test_helper.rb
xebec-2.3.0 test/test_helper.rb
xebec-2.2.0 test/test_helper.rb
xebec-2.1.0 test/test_helper.rb
xebec-2.0.0 test/test_helper.rb