Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up test helper.

  • Loading branch information...
commit b88af809162091de554acf9579120ae341a7d8a8 1 parent bc22f9c
Andy Stewart authored
2  init.rb
... ...
@@ -1 +1 @@
1  
-# Include hook code here
  1
+require 'paper_trail'
8  paper_trail.gemspec
... ...
@@ -1,15 +1,15 @@
1 1
 # Generated by jeweler
2 2
 # DO NOT EDIT THIS FILE DIRECTLY
3  
-# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
  3
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4 4
 # -*- encoding: utf-8 -*-
5 5
 
6 6
 Gem::Specification.new do |s|
7 7
   s.name = %q{paper_trail}
8  
-  s.version = "1.4.0"
  8
+  s.version = "1.4.1"
9 9
 
10 10
   s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11 11
   s.authors = ["Andy Stewart"]
12  
-  s.date = %q{2010-01-06}
  12
+  s.date = %q{2010-03-18}
13 13
   s.email = %q{boss@airbladesoftware.com}
14 14
   s.extra_rdoc_files = [
15 15
     "README.md"
@@ -29,9 +29,7 @@ Gem::Specification.new do |s|
29 29
      "lib/paper_trail/has_paper_trail.rb",
30 30
      "lib/paper_trail/version.rb",
31 31
      "paper_trail.gemspec",
32  
-     "rails/init.rb",
33 32
      "tasks/paper_trail_tasks.rake",
34  
-     "test/database.yml",
35 33
      "test/paper_trail_controller_test.rb",
36 34
      "test/paper_trail_model_test.rb",
37 35
      "test/paper_trail_schema_test.rb",
1  rails/init.rb
... ...
@@ -1 +0,0 @@
1  
-require 'paper_trail'
18  test/database.yml
... ...
@@ -1,18 +0,0 @@
1  
-sqlite3:
2  
-  adapter: sqlite3
3  
-  database: ":memory:"
4  
-
5  
-postgresql:
6  
-  adapter: postgresql
7  
-  username: postgres
8  
-  password: postgres
9  
-  database: paper_trail_plugin_test
10  
-  min_messages: ERROR
11  
-
12  
-mysql:
13  
-  adapter: mysql
14  
-  host: localhost
15  
-  username: andy
16  
-  password: 
17  
-  database: paper_trail_plugin_test
18  
-  socket: /tmp/mysql.sock
9  test/paper_trail_controller_test.rb
... ...
@@ -1,4 +1,4 @@
1  
-require File.dirname(__FILE__) + '/test_helper.rb'
  1
+require 'test_helper'
2 2
 
3 3
 class ApplicationController < ActionController::Base
4 4
   def rescue_action(e)
@@ -32,10 +32,11 @@ def destroy
32 32
 
33 33
 
34 34
 class PaperTrailControllerTest < ActionController::TestCase #Test::Unit::TestCase
  35
+  tests WidgetsController
35 36
   def setup
36  
-    @controller = WidgetsController.new
37  
-    @request = ActionController::TestRequest.new
38  
-    @response = ActionController::TestResponse.new
  37
+    #@controller = WidgetsController.new
  38
+    #@request = ActionController::TestRequest.new
  39
+    #@response = ActionController::TestResponse.new
39 40
 
40 41
     ActionController::Routing::Routes.draw do |map|
41 42
       map.resources :widgets
6  test/paper_trail_model_test.rb
... ...
@@ -1,4 +1,4 @@
1  
-require File.dirname(__FILE__) + '/test_helper.rb'
  1
+require 'test_helper'
2 2
 
3 3
 class Widget < ActiveRecord::Base
4 4
   has_paper_trail
@@ -30,7 +30,7 @@ class HasPaperTrailModelTest < Test::Unit::TestCase
30 30
 
31 31
   context 'A record' do
32 32
     setup { @article = Article.create }
33  
-    
  33
+
34 34
     context 'which updates an ignored column' do
35 35
       setup { @article.update_attributes :title => 'My first title' }
36 36
       should_not_change('the number of versions') { Version.count }
@@ -100,7 +100,7 @@ class HasPaperTrailModelTest < Test::Unit::TestCase
100 100
           assert_match /update/i, @widget.versions.last.event
101 101
         end
102 102
 
103  
-        
  103
+
104 104
         context 'and has one associated object' do
105 105
           setup do
106 106
             @wotsit = @widget.create_wotsit :name => 'John'
54  test/test_helper.rb
... ...
@@ -1,43 +1,37 @@
1  
-require 'test/unit'
2  
-RAILS_ROOT = File.join(File.dirname(__FILE__), %w{.. .. .. ..})
3  
-$:.unshift(File.join(File.dirname(__FILE__), %w{.. lib}))
4  
-
5  
-unless defined?(ActiveRecord)
6  
-  if File.directory? RAILS_ROOT + 'config'
7  
-    puts 'using config/boot.rb'
8  
-    ENV['RAILS_ENV'] = 'test'
9  
-    require File.join(RAILS_ROOT, 'config', 'boot.rb')
10  
-  else
11  
-    # simply use installed gems if available
12  
-    puts 'using rubygems'
13  
-    require 'rubygems'
14  
-    gem 'actionpack'; gem 'activerecord'; gem 'activesupport'; gem 'rails'
15  
-  end
  1
+require 'rubygems'
16 2
 
17  
-  %w(action_pack action_controller active_record active_support initializer).each {|f| require f}
18  
-end
  3
+require 'test/unit'
19 4
 require 'shoulda'
20  
-require 'paper_trail'
21  
-
22  
-def connect_to_database
23  
-  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
24  
-  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
25 5
 
26  
-  db_adapter = ENV['DB'] || 'sqlite3'
  6
+require 'active_record'
  7
+require 'action_controller'
  8
+require 'action_controller/test_process'
  9
+require 'active_support'
  10
+require 'active_support/test_case'
27 11
 
28  
-  if db_adapter.nil?
29  
-    raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
30  
-  end
  12
+require 'lib/paper_trail'
31 13
 
32  
-  ActiveRecord::Base.establish_connection(config[db_adapter])
  14
+def connect_to_database
  15
+  ActiveRecord::Base.establish_connection(
  16
+    :adapter  => "sqlite3",
  17
+    :database => ":memory:"
  18
+  )
  19
+  ActiveRecord::Migration.verbose = false
33 20
 end
34 21
 
35 22
 def load_schema
36 23
   connect_to_database
37  
-  load(File.dirname(__FILE__) + "/schema.rb")
38  
-  require File.dirname(__FILE__) + '/../rails/init.rb'
  24
+  load File.dirname(__FILE__) + '/schema.rb'
39 25
 end
40 26
 
41 27
 def change_schema
42  
-  load(File.dirname(__FILE__) + "/schema_change.rb")
  28
+  load File.dirname(__FILE__) + '/schema_change.rb'
  29
+end
  30
+
  31
+class ActiveRecord::Base
  32
+  def logger
  33
+    @logger ||= Logger.new(nil)
  34
+  end
43 35
 end
  36
+
  37
+load_schema

0 notes on commit b88af80

Please sign in to comment.
Something went wrong with that request. Please try again.