mardi 25 octobre 2016

RSpec testing: Test failing after moving model to another location

I am doing refactoring for my models-I've to move my ruby models to a another location.

Previous locations for my ruby file, spec file and fixtures file-

app/models/facebook_information.rb
spec/models/facebook_information_spec.rb
spec/fixtures/facebook_information.yml

If I keep my model in this path my RSPEC test is running smoothly.

But I've to move this to

app/models/facebook/facebook_information.rb

I think I've to move other files such as spec and fixture file to facebook folder so I moved. New directory looks like now-

spec/models/facebook/facebook_information_spec.rb
spec/fixtures/facebook/facebook_information.yml

After running RAILS_ENV=test bundle exec rspec spec/models/facebook/facebook_information_spec.rb I am getting below error-

            Failures:

          1) Facebook::FacebookInformation validation success
             Failure/Error: Unable to find matching line from backtrace
             Errno::ENOENT:
               No such file or directory @ rb_sysopen - /Users/raj.sharma/Desktop/Ibiza/spec/fixtures/facebook_information.yml
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixture_set/file.rb:33:in `read'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixture_set/file.rb:33:in `rows'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixture_set/file.rb:24:in `each'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:742:in `block (2 levels) in read_fixture_files'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixture_set/file.rb:15:in `open'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:741:in `block in read_fixture_files'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:740:in `each'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:740:in `each_with_object'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:740:in `read_fixture_files'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:586:in `initialize'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:512:in `new'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:512:in `block (2 levels) in create_fixtures'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:509:in `map'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/fixtures.rb:509:in `block in create_fixtures'
             # /Users/raj.sharma/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:293:in `disable_referential_integrity'

Please help.

Aucun commentaire:

Enregistrer un commentaire