mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
prepare for the specs
This commit is contained in:
parent
30cbc38d4e
commit
ff721e02d5
5 changed files with 39 additions and 9 deletions
1
.rspec
1
.rspec
|
@ -1 +1,2 @@
|
|||
--color
|
||||
--format=d
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
|
||||
describe "Kaminari" do
|
||||
it "fails" do
|
||||
fail "hey buddy, you should probably rename this file and start specing for real"
|
||||
end
|
||||
end
|
|
@ -1,12 +1,37 @@
|
|||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
||||
require 'rspec'
|
||||
require 'active_support/all'
|
||||
require 'active_record'
|
||||
require 'rails'
|
||||
require 'action_controller/railtie'
|
||||
require 'action_view/railtie'
|
||||
require 'rspec/rails'
|
||||
|
||||
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
|
||||
ActiveRecord::Base.establish_connection('test')
|
||||
|
||||
require 'kaminari'
|
||||
|
||||
app = Class.new(Rails::Application)
|
||||
app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
|
||||
app.config.session_store :cookie_store, :key => "_myapp_session"
|
||||
app.config.active_support.deprecation = :log
|
||||
app.initialize!
|
||||
|
||||
app.routes.draw do
|
||||
resources :users
|
||||
end
|
||||
|
||||
Object.const_set(:ApplicationHelper, Module.new)
|
||||
|
||||
# Requires supporting files with custom matchers and macros, etc,
|
||||
# in ./support/ and its subdirectories.
|
||||
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
||||
|
||||
RSpec.configure do |config|
|
||||
|
||||
config.mock_with :rr
|
||||
config.before :all do
|
||||
# ActiveRecord::Base.connection.execute 'CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))' unless ActiveRecord::Base.connection.table_exists? 'users'
|
||||
CreateUsers.up unless ActiveRecord::Base.connection.table_exists? 'users'
|
||||
end
|
||||
end
|
||||
|
|
8
spec/support/20110128122508_create_users.rb
Normal file
8
spec/support/20110128122508_create_users.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class CreateUsers < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :users do |t|
|
||||
t.string :name
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
3
spec/support/user.rb
Normal file
3
spec/support/user.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class User < ActiveRecord::Base
|
||||
default_scope order('name')
|
||||
end
|
Loading…
Reference in a new issue