Yan Zhao
Yan Zhao

Reputation: 223

Using Rspec with Rails and Neo4j.rb: missing method

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

Upvotes: 1

Views: 561

Answers (1)

Yan Zhao
Yan Zhao

Reputation: 223

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

Upvotes: 3

Related Questions