2012-05-03 4 views
5

私はインストールジェネレータを含むsimpe gemを作成しますが、ジェネレータはうまく動作しますが、今はrspecを使ってテストしたいと思います。私はこのgemを試してみてください。 /stuff/work/my_projects/rosalie/lib/rosalie/engine.rb:2:in ` ':初期化されていないrspecを使ったテストエンジンジェネレータ

require 'genspec' 
require 'rosalie' 

describe :install_generator do 

    it "should generate model" do 
    subject.should generate("message.rb") 
    end 
end 

ロザリーは今、私はそれを実行すると、私はエラーを得た、5月の宝石の名前です。定数Rosalie :: Rails(NameError)

私のエンジン.rbコードは:

module Rosalie 
    class Engine < Rails::Engine 

    initializer "rosalie.models.messageable" do 
     ActiveSupport.on_load(:active_record) do 
     include Rosalie::Models::Messageable 
     end 
    end 
    end 
end 

誰でもこの問題を解決できますか?

答えて

1

あなたspec_helper.rbでこれらのコードを追加必要があり、それぞれの仕様でspec_helperが必要です。

require File.expand_path("../dummy/config/environment", __FILE__) 
require 'rspec/rails' 
関連する問題