Sha256: 287845f98eddbb5b9d7ee575846222a8d6fc8e829f1896081319769893d5cb62

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 KB

Contents

unless defined? SPEC_ROOT
  ENV["RAILS_ENV"] = "test"
  
  SPEC_ROOT = File.expand_path(File.dirname(__FILE__))
  
  unless defined? RADIANT_ROOT
    if env_file = ENV["RADIANT_ENV_FILE"]
      require env_file
    else
      require File.expand_path(SPEC_ROOT + "/../config/environment")
    end
  end
  require 'spec'
  require 'spec/rails'
  require 'scenarios'
  
  class Test::Unit::TestCase
    class << self
      # Class method for test helpers
      def test_helper(*names)
        names.each do |name|
          name = name.to_s
          name = $1 if name =~ /^(.*?)_test_helper$/i
          name = name.singularize
          first_time = true
          begin
            constant = (name.camelize + 'TestHelper').constantize
            self.class_eval { include constant }
          rescue NameError
            filename = File.expand_path(SPEC_ROOT + '/../test/helpers/' + name + '_test_helper.rb')
            require filename if first_time
            first_time = false
            retry
          end
        end
      end    
      alias :test_helpers :test_helper
    end
  end
  
  Dir[RADIANT_ROOT + '/spec/matchers/*_matcher.rb'].each do |matcher|
    require matcher
  end
  
  Scenario.load_paths.unshift "#{RADIANT_ROOT}/spec/scenarios"
  
  Spec::Runner.configure do |config|
    config.use_transactional_fixtures = true
    config.use_instantiated_fixtures  = false
    config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
    
    # You can declare fixtures for each behaviour like this:
    #   describe "...." do
    #     fixtures :table_a, :table_b
    #
    # Alternatively, if you prefer to declare them only once, you can
    # do so here, like so ...
    #
    #   config.global_fixtures = :table_a, :table_b
    #
    # If you declare global fixtures, be aware that they will be declared
    # for all of your examples, even those that don't use them.
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-0.6.5.1 spec/spec_helper.rb
radiant-0.6.5 spec/spec_helper.rb
radiant-0.6.7 spec/spec_helper.rb
radiant-0.6.6 spec/spec_helper.rb
radiant-0.6.8 spec/spec_helper.rb
radiant-0.6.9 spec/spec_helper.rb