Ruby 将Rspec与Rails和Neo4j.rb一起使用:缺少方法

Ruby 将Rspec与Rails和Neo4j.rb一起使用:缺少方法,ruby,ruby-on-rails-3,rspec,neo4j,jruby,Ruby,Ruby On Rails 3,Rspec,Neo4j,Jruby,请帮忙 我正在用rails和neo4j做一个项目,用ronge的neo4j.rb gem。我可以让发电机和积垢与Neo4j一起工作。但是,每次我运行'rspec'测试时,spec\u helper中rspec的configure块中都会出现方法缺失错误 有人能帮我弄清楚吗 非常感谢 Rails和JRuby版本。 saasbook@saasbook:~/temp$rails-v 轨道3.2.17 saasbook@saasbook:~/temp$ruby-v jruby 1.7.10(1.9.3p

请帮忙

我正在用rails和neo4j做一个项目,用ronge的neo4j.rb gem。我可以让发电机和积垢与Neo4j一起工作。但是,每次我运行'rspec'测试时,spec\u helper中rspec的configure块中都会出现方法缺失错误

有人能帮我弄清楚吗

非常感谢

Rails和JRuby版本。

saasbook@saasbook:~/temp$rails-v
轨道3.2.17
saasbook@saasbook:~/temp$ruby-v
jruby 1.7.10(1.9.3p392)2014-01-09 Java HotSpot(TM)客户端VM上的c4ecd6b 1.7.0_51-b13[linux-i386]

创建Rails应用程序

rails新myapp-mhttp://andreasronge.github.com/neo4j/rails.rb -O-T

Gemfile

source 'https://rubygems.org'
gem 'rails', '3.2.17'
gem 'jruby-openssl'
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'therubyrhino'
  gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'

group :development, :test do
  gem "rspec-rails"
end

gem "neo4j"
那么

运行
rspec
时,出现以下错误:

saasbook@saasbook:~/test/myapp$ rspec
NoMethodError: undefined method `fixture_path=' for #<RSpec::Core::Configuration:0xbcf6bf>
           (root) at /home/saasbook/test/myapp/spec/spec_helper.rb:21
        configure at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core.rb:120
           (root) at /home/saasbook/test/myapp/spec/spec_helper.rb:11
          require at org/jruby/RubyKernel.java:1083
           (root) at /home/saasbook/test/myapp/spec/models/testnode_spec.rb:1
             load at org/jruby/RubyKernel.java:1099
           (root) at /home/saasbook/test/myapp/spec/models/testnode_spec.rb:1
             each at org/jruby/RubyArray.java:1613
           (root) at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:1
  load_spec_files at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896
  load_spec_files at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896
              run at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22

已解决,请参阅有关问题的评论


:fixture_path和:use_transactional_fixture是rspec rails仅在ActiveRecord存在的情况下添加的两个设置。因此,它们当然是缺少方法的。只需将它们注释掉,如果使用Neo4j.rb,就不需要它们了

如果按照注释中的建议删除fixture_路径行会发生什么?完成。。。这已经解决了。。。实际上,我追溯到rspec rails,发现:fixture_path是一个只有在AR出现时才会添加的设置。。。当然,这是一个缺少的方法,所以:也使用事务性装置。很抱歉粗心大意,我应该更仔细地查找源代码。非常感谢:荣格!
saasbook@saasbook:~/test/myapp$ rspec
NoMethodError: undefined method `fixture_path=' for #<RSpec::Core::Configuration:0xbcf6bf>
           (root) at /home/saasbook/test/myapp/spec/spec_helper.rb:21
        configure at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core.rb:120
           (root) at /home/saasbook/test/myapp/spec/spec_helper.rb:11
          require at org/jruby/RubyKernel.java:1083
           (root) at /home/saasbook/test/myapp/spec/models/testnode_spec.rb:1
             load at org/jruby/RubyKernel.java:1099
           (root) at /home/saasbook/test/myapp/spec/models/testnode_spec.rb:1
             each at org/jruby/RubyArray.java:1613
           (root) at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:1
  load_spec_files at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896
  load_spec_files at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896
              run at /home/saasbook/.rvm/gems/jruby-1.7.10/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

RSpec.configure do |config|
  # ## Mock Framework
  #
  # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr

  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  # If you're not using ActiveRecord, or you'd prefer not to run each of your
  # examples within a transaction, remove the following line or assign false
  # instead of true.
  config.use_transactional_fixtures = true

  # If true, the base class of anonymous controllers will be inferred
  # automatically. This will be the default behavior in future versions of
  # rspec-rails.
  config.infer_base_class_for_anonymous_controllers = false

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = "random"
end