When I run the test “ rspec spec/cart_spec.rb ”In the console, I'll get a warning

Vitalik Andrysha

When I run the test “ rspec spec/cart_spec.rb ”In the console, I'll get a warning

    require 'rspec'
    require_relative '../app/item'
    require_relative '../app/virtual_item'
    require_relative '../app/antique_item'
    require_relative '../app/item_container'
    require_relative '../app/cart'

    describe Cart do

      it 'add items into the cart' do
        cart = Cart.new('')
        item1 = Item.new('kettle', price: 200)
        item2 = Item.new('car', price: 200)
        cart.add_items(item1, item2)
        cart.items.should include(item1, item2)
      end

    end

In the console, I'll get a warning

E:\work\storeapp\spec>rspec spec/cart_spec.rb
c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/configuration.rb:1226:in `load': cannot load such file -- E:/work/storeapp/spec/spec/cart_s
pec.rb (LoadError)
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/configuration.rb:1224:in `each'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/runner.rb:97:in `setup'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/runner.rb:85:in `run'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/runner.rb:70:in `run'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/lib/rspec/core/runner.rb:38:in `invoke'
        from c:/tools/rubies/ruby-2.1.5-p273/lib/ruby/gems/2.1.0/gems/rspec-core-3.2.2/exe/rspec:4:in `<top (required)>'
        from c:/tools/rubies/ruby-2.1.5-p273/bin/rspec:23:in `load'
        from c:/tools/rubies/ruby-2.1.5-p273/bin/rspec:23:in `<main>'

![enter image description here][1]

where is my mistake?

Mori

The error says that it can't find the spec file and indeed you're pointing to

spec/cart_spec.rb

... while in the spec directory. To find it from there you need to remove spec/:

rspec cart_spec.rb

My usual practice is to run specs from the app root. From there, your original command should work. Or you can just use an absolute path instead of a relative path.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

When I run the test “ rspec item_container_spec.rb ”In the console, I'll get a warning

From Dev

When run RSpec I get uninitialized constant Name::Name::Engine

From Dev

Why does my rspec test pass by itself but fails when I give a specific test to run?

From Dev

Routes Increment when I Run Rspec feature

From Dev

Routes Increment when I Run Rspec feature

From Dev

How do I run an RSpec test on a specific line?

From Dev

How do I share code across a test run in rspec?

From Dev

Rails Rspec - I can't run any test (Postgres error)

From Dev

When running specs with RSpec in Rails, how do I access the test_database concurrently via the rails console or an external script?

From Java

Why I get the console warning: [Process] kill() returned unexpected error 1 when I load a WKWebView in iOS13.2?

From Dev

Get a warning when I overwrite a function in Julia?

From Dev

I get warning when creating delegate

From Dev

Can I get a warning when merging folders?

From Dev

Can I get a warning when merging folders?

From Dev

I get warning when creating delegate

From Dev

Rspec generator to create a *_spec.rb file to test a PORO

From Dev

When I try to run ApiGen I get a PHP Warning: require(Texy.php): failed to open stream: No such file or directory

From Dev

Rspec fails but behaviour works when I test it via controller

From Dev

When I add rspec test, other tests start failing

From Dev

How do I get this very simple rspec test to pass?

From Dev

Why do I get a syntax error if I run this in the console? {} === {}

From Dev

Some of my classes are not loading correctly when I run Rspec

From Dev

Error on jest when I try to run the test

From Dev

Different kind of exception while i run test both eclipse and console?

From Dev

when I do update-grub I get a warning

From Dev

When I run npm run start I get this error

From Dev

Is it possible to run a script when RSpec finishes a test

From Dev

Cant get helper test to run - Rails/Rspec

From Dev

Apple Wallet - What is the distance from a location waypoint when I'll get the notification?

Related Related

  1. 1

    When I run the test “ rspec item_container_spec.rb ”In the console, I'll get a warning

  2. 2

    When run RSpec I get uninitialized constant Name::Name::Engine

  3. 3

    Why does my rspec test pass by itself but fails when I give a specific test to run?

  4. 4

    Routes Increment when I Run Rspec feature

  5. 5

    Routes Increment when I Run Rspec feature

  6. 6

    How do I run an RSpec test on a specific line?

  7. 7

    How do I share code across a test run in rspec?

  8. 8

    Rails Rspec - I can't run any test (Postgres error)

  9. 9

    When running specs with RSpec in Rails, how do I access the test_database concurrently via the rails console or an external script?

  10. 10

    Why I get the console warning: [Process] kill() returned unexpected error 1 when I load a WKWebView in iOS13.2?

  11. 11

    Get a warning when I overwrite a function in Julia?

  12. 12

    I get warning when creating delegate

  13. 13

    Can I get a warning when merging folders?

  14. 14

    Can I get a warning when merging folders?

  15. 15

    I get warning when creating delegate

  16. 16

    Rspec generator to create a *_spec.rb file to test a PORO

  17. 17

    When I try to run ApiGen I get a PHP Warning: require(Texy.php): failed to open stream: No such file or directory

  18. 18

    Rspec fails but behaviour works when I test it via controller

  19. 19

    When I add rspec test, other tests start failing

  20. 20

    How do I get this very simple rspec test to pass?

  21. 21

    Why do I get a syntax error if I run this in the console? {} === {}

  22. 22

    Some of my classes are not loading correctly when I run Rspec

  23. 23

    Error on jest when I try to run the test

  24. 24

    Different kind of exception while i run test both eclipse and console?

  25. 25

    when I do update-grub I get a warning

  26. 26

    When I run npm run start I get this error

  27. 27

    Is it possible to run a script when RSpec finishes a test

  28. 28

    Cant get helper test to run - Rails/Rspec

  29. 29

    Apple Wallet - What is the distance from a location waypoint when I'll get the notification?

HotTag

Archive