0

I am working on an existing RoR app which was written a few years ago. It's testers were less than satisfying so the whole /spec directory was removed and I have to write new rspecs. I have seen somewhere that it is possible to generate non-blank rspecs using scaffold method. When I tried doing

rails generate scaffold rspec:model User

I got the lovely result of

invoke  active_record
/home/guy/railsProjects/netAdmin/vendor/ruby/2.0.0/gems/railties-4.1.6/lib/rails/generators/base.rb:258:in `const_defined?': wrong constant name Rspec:model (NameError)
    from /home/guy/railsProjects/netAdmin/vendor/ruby/2.0.0/gems/railties-4.1.6/lib/rails/generators/base.rb:258:in `block in class_collisions'

how do I work it out? having something that will write some of the specs, based on the existing models and controllers will save me tons of time. Thanks in advance!

Spätzle
  • 709
  • 10
  • 20
  • Some things to check: Do you have the `gem 'rspec-rails'` available in both development (for the generator) and test environments? And have you run rails `generate rspec:install`? And if so, what's your gem version? – steel Nov 25 '14 at 15:03
  • of course I have them. my rspec version is 2.14.1 nifty-generator adds some auto-made test to scaffolds that you create, but I look for something that will see my existing model and will write an appropriate spec. is this possible? – Spätzle Nov 25 '14 at 15:18
  • I've never seen it, but that doesn't mean it doesn't exist. Regardless, your command should be passing and creating the spec files I would think. – steel Nov 25 '14 at 16:14

0 Answers0