Skip to content
Browse files

Preparing application to use rails

  • Loading branch information...
1 parent 8f276e6 commit 7c8fbf3a48310474025479d8cb0506ed92db6a46 Lucas Souza committed Oct 20, 2011
Showing with 28 additions and 2 deletions.
  1. +6 −1 Gemfile
  2. +8 −0 spec/fake_app.rb
  3. +14 −1 spec/spec_helper.rb
View
7 Gemfile
@@ -3,6 +3,11 @@ source "http://rubygems.org"
# Specify your gem's dependencies in will_paginate_mongoid.gemspec
gemspec
+group :development do
+ gem "rails", "3.0.0"
+end
+
group :test do
- gem "rspec", "2.7.0"
+ gem "rspec", "2.7.0"
+ gem "rspec-rails", "2.7.0"
end
View
8 spec/fake_app.rb
@@ -0,0 +1,8 @@
+require 'action_controller/railtie'
+require 'action_view/railtie'
+
+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!
View
15 spec/spec_helper.rb
@@ -1,9 +1,22 @@
+require 'rails'
require 'mongoid'
require 'will_paginate'
require 'will_paginate_mongoid'
+require File.join(File.dirname(__FILE__), 'fake_app')
+require 'rspec/rails'
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.mock_with :rspec
-end
+ config.before :each do
+ Mongoid.master.collections.select do |collection|
+ collection.name !~ /system/
+ end.each(&:drop)
+ end
+end
+
+Mongoid.configure do |config|
+ config.master = Mongo::Connection.new.db("will_paginate_mongoid")
+end

0 comments on commit 7c8fbf3

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