Permalink
Browse files

use spectask to better run on ci server

  • Loading branch information...
1 parent ac20d82 commit fae66944e7ad4bee0c487883c8a27c2ab897ddde @grosser committed Nov 18, 2009
Showing with 17 additions and 26 deletions.
  1. +3 −6 Rakefile.rb
  2. +2 −0 lib/random_records.rb
  3. +9 −4 spec/setup_test_model.rb
  4. +3 −16 spec/spec_helper.rb
View
@@ -1,9 +1,6 @@
-desc "Run all specs in spec directory"
-task :default do
- options = "--colour --format progress --loadby --reverse"
- files = FileList['spec/**/*_spec.rb']
- system("spec #{options} #{files}")
-end
+task :default => :spec
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color']}
begin
require 'jeweler'
View
@@ -1,3 +1,5 @@
+require 'active_record'
+
class ActiveRecord::Base
def self.random(num=nil,options={})
return_array = !num.nil?
View
@@ -1,15 +1,20 @@
-require 'rubygems'
-require 'active_record'
+# connect
+ActiveRecord::Base.configurations = {"test" => {
+ :adapter => "sqlite3",
+ :database => ":memory:",
+}.with_indifferent_access}
-#create model table
+ActiveRecord::Base.establish_connection(:test)
+
+# create table
ActiveRecord::Schema.define(:version => 1) do
create_table "users" do |t|
t.integer :age
t.timestamps
end
end
-#create model
+# create model
class User < ActiveRecord::Base
named_scope :first_5, :conditions=>"id < 6"
end
View
@@ -1,19 +1,6 @@
-# ---- requirements
require 'rubygems'
-require 'spec'
-$LOAD_PATH << File.expand_path("../lib", File.dirname(__FILE__))
+$LOAD_PATH << 'lib'
+require 'init'
-
-# ---- Prepare models
-require 'active_record'
-
-RAILS_ENV = "test"
-ActiveRecord::Base.establish_connection({
- :adapter => "sqlite3",
- :database => ":memory:",
-})
-
-# ---- setup environment/plugin
-require File.expand_path("../init", File.dirname(__FILE__))
-load File.expand_path("setup_test_model.rb", File.dirname(__FILE__))
+require 'spec/setup_test_model'

0 comments on commit fae6694

Please sign in to comment.