spec/spec_helper.rb in map_fields-1.0.4 vs spec/spec_helper.rb in map_fields-2.0.0.beta
- old
+ new
@@ -1,45 +1,13 @@
-RAILS_ROOT = File.join(File.dirname(__FILE__), 'rails_root')
-RAILS_ENV = 'test'
+ENV['RAILS_ENV'] = 'test'
-#Needed for autospec
-$LOAD_PATH << "spec"
-$LOAD_PATH << "lib"
+$:.unshift File.expand_path('../../lib', __FILE__)
-require 'rubygems'
-#Needed for rspec_rails
-require 'rails/version'
-require 'action_controller'
-require 'action_controller/test_process'
-require 'spec/rails'
-require File.join(File.dirname(__FILE__), '..', 'lib', 'map_fields')
+require 'bundler'
+require File.expand_path('../../rails_app/config/environment.rb', __FILE__)
+require 'rails/test_help'
+require 'rspec/rails'
+require 'map_fields'
-require File.join(File.dirname(__FILE__), '..', 'init')
-
-Spec::Runner.configure do |config|
- #config.use_transactional_fixtures = true
-end
-
-class TestController < ApplicationController
- map_fields :create, ['Title', 'First name', 'Last name'], :params => [:user]
-
- def new
- end
-
- def create
- if fields_mapped?
- mapped_fields.each do |row|
- #deal with the data
- row[0] #=> will be Title
- row[1] #=> will be First name
- row[2] #=> will be Last name
- end
- render :text => ''
- else
- render 'map_fields/_map_fields'
- end
- end
-end
-
-ActionController::Routing::Routes.draw do |map|
- map.resources :test
+RailsApp::Application.routes.draw do
+ resources :test
end