Sha256: 12056b6fcff4194bc83fa38fc12f131a5d5b1af1f6d932b15eddcc6221758de3

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

unless $rtml_spec_helper_already_loaded
  $rtml_spec_helper_already_loaded = 1
  $LOAD_PATH << File.join(File.dirname(__FILE__), 'support/app/controllers')

  unless defined?(RAILS_ROOT)
    require File.join(File.dirname(__FILE__), 'support/rails')
    gem 'rspec-rails'
    gem 'webrat'
  end

  begin
    require 'spec/autorun'
    require 'spec/rails'
    require 'webrat'
    require 'webrat/integrations/rspec-rails'
  rescue LoadError
    puts $!.message
    puts
    puts "Please make sure the following development dependencies are installed before continuing:"
    puts "  rspec"
    puts "  rspec-rails"
    puts "  webrat"
    exit
  end

  require 'rtml/test/spec'
  Spec::Example::ExampleGroupFactory.default(RtmlExampleGroup)
  # Now... this is redundant for working project tests, but absolutely critical for in-Rails tests.
  # TODO: Don't load it if it's redundant... Need to know whether it's in-rails or not for that, though.
  ActionController::Base.view_paths << File.join(File.dirname(__FILE__), 'support/app/views')
  Rtml.configuration.rtml_helper_paths << File.join(File.dirname(__FILE__), 'support/app/rtml_helpers')
  Rtml.configuration.widget_paths << File.join(File.dirname(__FILE__), 'support/lib/rtml/widgets')
  require File.join(File.dirname(__FILE__), 'support/app/controllers/inherited_controller')

  Dir[File.expand_path(File.join(File.dirname(__FILE__),'support/rspec','**','*.rb'))].each {|f| require f }

  Spec::Runner.configure do |config|
    config.after(:each) do
      Rtml::Document.destroy_all
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rtml-2.0.3 spec/spec_helper.rb
rtml-2.0.2 spec/spec_helper.rb