Permalink
Browse files

trying to test engine support

  • Loading branch information...
1 parent 79b3dab commit 5a55301a41e1bb35dc4a9900b4e2573b4f537768 @moonmaster9000 committed Jun 14, 2011
View
4 lib/wallet/engine_railtie.rb
@@ -3,8 +3,8 @@
module Wallet
module Railtie
def self.included(base)
- base.config.before_eager_load do
- wallet = base.root + "/config/wallet.rb"
+ base.config.before_initialize do
+ wallet = "#{base.root}/config/wallet.rb"
require wallet if File.exists?(wallet)
end
end
View
2 lib/wallet/railtie.rb
@@ -3,7 +3,7 @@
module Wallet
module Rails
class Railtie < ::Rails::Railtie
- config.before_eager_load do
+ config.before_initialize do
wallet = ::Rails.root.to_s + "/config/wallet.rb"
require wallet if File.exists?(wallet)
end
View
1 test_wallet_app/Gemfile
@@ -2,6 +2,7 @@ source 'http://rubygems.org'
gem 'rails', '3.0.8'
gem 'wallet', :path => '../'
+gem 'test_wallet_engine', :path => '../test_wallet_engine'
group :test, :development do
gem 'cucumber-rails'
View
8 test_wallet_app/Gemfile.lock
@@ -1,9 +1,14 @@
PATH
remote: ../
specs:
- wallet (1.0.0.beta.1)
+ wallet (1.0.0.beta.2)
rails (~> 3.0)
+PATH
+ remote: ../test_wallet_engine
+ specs:
+ test_wallet_engine (1)
+
GEM
remote: http://rubygems.org/
specs:
@@ -126,4 +131,5 @@ DEPENDENCIES
cucumber-rails
rails (= 3.0.8)
rspec-rails
+ test_wallet_engine!
wallet!
View
5 test_wallet_engine/app/controllers/dashboard_controller.rb
@@ -0,0 +1,5 @@
+class DashboardController < ApplicationController
+ def index
+ render :text => "dashboard!"
+ end
+end
View
3 test_wallet_engine/config/routes.rb
@@ -0,0 +1,3 @@
+Rails.application.routes.draw do
+ resources :dashboard
+end
View
5 test_wallet_engine/config/wallet.rb
@@ -0,0 +1,5 @@
+Wallet.open do
+ cash :dashboard do
+ index 45.hours
+ end
+end
View
1 test_wallet_engine/lib/test_wallet_engine.rb
@@ -0,0 +1 @@
+require 'test_wallet_engine/engine'
View
8 test_wallet_engine/lib/test_wallet_engine/engine.rb
@@ -0,0 +1,8 @@
+require 'test_wallet_engine'
+require 'rails'
+
+module TestWalletEngine
+ class Engine < ::Rails::Engine
+ include Wallet::Railtie
+ end
+end

0 comments on commit 5a55301

Please sign in to comment.