레일스 엔진 인 소셜 스트림 젬을 기반으로 응용 프로그램을 구축하고 있습니다. 나는 Rakefile을 가지고있다. 내 Gemfile에 factory-girl gem을 포함 시켰지만 어떤 이유 때문에 레이크 작업이 해당 클래스에서 실패합니다.레일 엔진에 대한 테스트 실행 중 오류가 발생했습니다.
보석에 많은 테스트가 있습니다. 실행하고 싶습니다.
# Helpers for building the post activity
#
class ActivityObjectSpecHelper < ActiveRecord::Base
set_table_name "activity_objects"
end
class PostSpecHelper < ActiveRecord::Base
set_table_name "posts"
belongs_to :activity_object_spec_helper, :foreign_key => "activity_object_id"
end
Factory.define :activity_object_spec_helper do |a|
a.object_type "Post"
a.description "Post spec helper"
end
Factory.define :post_spec_helper do |p|
p.association :activity_object_spec_helper
end
/Users/sean/.rvm/gems/ruby-1.9.3-p327/gems/social_stream-base- 1.1.4/spec/factories/activity.rb:13:in `<top (required)>': uninitialized constant Factory (NameError)
from /Users/sean/Dropbox/fluent/sstest/spec/spec_helper.rb:22:in `block in <top (required)>'
Rakefile
#!/usr/bin/env rake
require 'rspec/core'
require 'rspec/core/rake_task'
require 'resque/tasks'
require File.expand_path('../config/application', __FILE__)
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection } if Resque.present?
# Include social_stream-base spec
def bsp(str)
base_spec_path = File.join(Gem::Specification.find_by_name('social_stream- base').full_gem_path, 'spec/')
File.join(base_spec_path, str)
end
RSpec::Core::RakeTask.new(:spec) do |s|
s.pattern = ['./spec/**/*_spec.rb',
bsp('./controllers/users_controller_spec.rb'),
bsp('./controllers/notifications_controller_spec.rb'),
bsp('./controllers/likes_controller_spec.rb'),
bsp('./controllers/profiles_controller_spec.rb'),
bsp('./controllers/comments_controller_spec.rb'),
bsp('./controllers/frontpage_controller_spec.rb'),
bsp('./controllers/posts_controller_spec.rb'),
bsp('./controllers/representations_spec.rb'),
bsp('./controllers/groups_controller_spec.rb'),
bsp('./controllers/settings_controller_spec.rb'),
bsp('./models/profile_spec.rb'),
bsp('./models/user_spec.rb'),
bsp('./models/tie_spec.rb'),
bsp('./models/activity_spec.rb'),
bsp('./models/actor_spec.rb'),
bsp('./models/group_spec.rb'),
bsp('./models/like_spec.rb'),
bsp('./models/post_spec.rb')
]
end
task :default => [ :spec, 'assets:precompile' ]
Sstest::Application.load_tasks
감사합니다. – ardochhigh