Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

set up test stuff

  • Loading branch information...
commit 3a1aff582a9d9875b09a77640044848bc131aaef 1 parent b4dcb34
@steveklabnik authored
View
6 Gemfile
@@ -2,3 +2,9 @@ source 'https://rubygems.org'
# Specify your gem's dependencies in active_record-observers.gemspec
gemspec
+
+if ENV['RAILS']
+ gem 'rails', path: ENV['RAILS']
+else
+ gem 'rails', git: 'git://github.com/rails/rails'
+end
View
10 Rakefile
@@ -1,2 +1,12 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"
+
+require 'rake/testtask'
+
+Rake::TestTask.new do |t|
+ t.libs = ["test"]
+ t.pattern = "test/**/*_test.rb"
+ t.ruby_opts = ['-w']
+end
+
+task :default => :test
View
4 active_record-observers.gemspec
@@ -14,4 +14,8 @@ Gem::Specification.new do |gem|
gem.name = "active_record-observers"
gem.require_paths = ["lib"]
gem.version = ActiveRecord::Observers::VERSION
+
+ gem.add_development_dependency 'minitest', '>= 3'
+ gem.add_development_dependency 'activerecord', '~> 4.0.0.beta'
+ gem.add_development_dependency 'sqlite3', '~> 1.3'
end
View
38 test/helper.rb
@@ -0,0 +1,38 @@
+require 'bundler/setup'
+require 'active_record-observers'
+require 'minitest/spec'
+require 'minitest/autorun'
+require 'active_record'
+
+ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
+
+ActiveRecord::Schema.verbose = false
+ActiveRecord::Schema.define do
+ create_table :posts do |t|
+ t.string :title
+ t.string :category
+ end
+
+ create_table :comments do |t|
+ t.string :title
+ t.references :post
+ end
+end
+
+class Post < ActiveRecord::Base
+ attr_accessible :id, :title, :category
+ has_many :comments
+end
+
+class Comment < ActiveRecord::Base
+ def self.lol
+ "lol"
+ end
+end
+
+require 'active_support/testing/deprecation'
+ActiveSupport::Deprecation.debug = true
+
+class MiniTest::Spec
+ include ActiveSupport::Testing::Deprecation
+end
Please sign in to comment.
Something went wrong with that request. Please try again.