Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use spectask to better run on ci server

  • Loading branch information...
commit fae66944e7ad4bee0c487883c8a27c2ab897ddde 1 parent ac20d82
@grosser authored
View
9 Rakefile.rb
@@ -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
2  lib/random_records.rb
@@ -1,3 +1,5 @@
+require 'active_record'
+
class ActiveRecord::Base
def self.random(num=nil,options={})
return_array = !num.nil?
View
13 spec/setup_test_model.rb
@@ -1,7 +1,12 @@
-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
@@ -9,7 +14,7 @@
end
end
-#create model
+# create model
class User < ActiveRecord::Base
named_scope :first_5, :conditions=>"id < 6"
end
View
19 spec/spec_helper.rb
@@ -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'
Please sign in to comment.
Something went wrong with that request. Please try again.