1

Please help,

I am doing a project with rails and neo4j with the neo4j.rb gem by ronge. I can get generator and CRUD working with Neo4j. But, everytime I run 'rspec' tests, there is method missing error within the configure block of RSpec within spec_helper.

Can anyone helps me figure this out?

Thanks so much!!

Rails and JRuby version.

saasbook@saasbook:~/temp$ rails -v Rails 3.2.17 saasbook@saasbook:~/temp$ ruby -v jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on Java HotSpot(TM) Client VM 1.7.0_51-b13 [linux-i386]

Create Rails App

rails new myapp -m http://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"

Then,

saasbook@saasbook:~/test/myapp$ rails g rspec:install
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
saasbook@saasbook:~/test/myapp$ rails g model testnode
      invoke  neo4j
      create    app/models/testnode.rb
      invoke    rspec
      create      spec/models/testnode_spec.rb

When I run rspec, here is the error:

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

Also, here is the generated spec_helper.rb file:

# 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
2
  • 2
    What happens if you remove the fixture_path line as suggested in the comment ? Feb 25, 2014 at 8:38
  • Done... this is resolved... actually I traced down to rspec-rails, and found out :fixture_path is a setting that will be added only when AR appears... so of course it is a method missing, so does : use_transactional_fixtures as well. Sorry for being careless, I should trace down to the source code more carefully. THANKS SO MUCH: Ronge!
    – Yan Zhao
    Feb 25, 2014 at 19:14

1 Answer 1

3

Resolved, see comments on the questions.

:fixture_path and :use_transactional_fixtures are two settings added by rspec-rails ONLY under the presence of ActiveRecord. So of course they are method missing. Just comment them out, you don't need them if you use Neo4j.rb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.