thoughtbot / suspenders

A Rails project template, intended to keep app baselines up to date. Includes shoulda, mocha, factory_girl, Hoptoad, git rake tasks, cap recipes, etc.

suspenders / test / test_helper.rb
100644 30 lines (22 sloc) 0.795 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require 'action_view/test_case'
 
Mocha::Configuration.warn_when(:stubbing_non_existent_method)
Mocha::Configuration.warn_when(:stubbing_non_public_method)
 
class ActiveSupport::TestCase
 
  self.use_transactional_fixtures = true
  self.use_instantiated_fixtures = false
 
end
 
class ActionView::TestCase
  class TestController < ActionController::Base
    attr_accessor :request, :response, :params
 
    def initialize
      @request = ActionController::TestRequest.new
      @response = ActionController::TestResponse.new
      
      # TestCase doesn't have context of a current url so cheat a bit
      @params = {}
      send(:initialize_current_url)
    end
  end
end