Oh, my god... I feel myself stupid... I should guess this solution myself...
Thanks alot Myron... воскресенье, 27 сентября 2015 г., 0:47:06 UTC+3 пользователь Myron Marston написал: > > In Ruby, if you have a class Foo::Bar definition, it will fail with an > error like the one you received if Foo has not already been defined. > That’s simply how Ruby works and has nothing to do with RSpec. The solution > is to change your class definition to: > > module Backup > class Status > # ... > endend > > (Note: that could be class Backup if that’s what you intend it to be.) > > Alternately, if you want to keep the class Backup::Status form, you’ll > have to require another file that does define the bare Backup class or > module. Typically this require would go at the top of your > lib/backup/status.rb file. > > HTH, > Myron > > > On Sat, Sep 26, 2015 at 10:56 AM, Igor Yurchenko <[email protected] > <javascript:>> wrote: > >> Thank you for answer. The adding "require 'backup/status'" causes error >> in lib/backup/status.rb: >> >> 20:14:54 - INFO - Running: spec/lib/backup/status_spec.rb >> Coverage report generated for RSpec to >> /home/space/devel/sole/sola/coverage. 1 / 7 LOC (14.29%) covered. >> /home/space/devel/sole/sola/lib/backup/status.rb:1:in `<top (required)>': >> uninitialized constant Backup (NameError) >> from >> /home/space/devel/sole/sola/spec/lib/backup/status_spec.rb:2:in `require' >> from >> /home/space/devel/sole/sola/spec/lib/backup/status_spec.rb:2:in `<top >> (required)>' >> >> lib/backup/status.rb contains: >> >> class Backup::Status >> ... >> end >> >> I have supposed gem rspec_rails is responsible for similar kind of >> problem. But... >> >> I would be very gratefull for any ideas how to solve this problem... >> >> >> суббота, 26 сентября 2015 г., 17:14:31 UTC+3 пользователь Myron Marston >> написал: >>> >>> RSpec does not do any constant autoloading so if you're getting and >>> uninitialized constant error but the constant is defined in a file, it >>> means that file hasn't been loaded yet. The simple solution is to >>> `require` the file. >>> >>> HTH, >>> Myron >>> >>> On Sat, Sep 26, 2015 at 4:46 AM, Igor Yurchenko <[email protected]> >>> wrote: >>> >>>> Hi, ppl... >>>> >>>> I need help with setting up rails evironment for rspec. I've created >>>> some code on lib/backup/status.rb path and matched specs at >>>> spec/lib/backup/status_spec.rb. >>>> >>>> The problem is the spec does not see Backup::Status constant defined at >>>> lib/backup/status.rb... >>>> >>>> >>>> Row "RSpec.describe Backup::Status do end" in spec/lib/backup/status.rb >>>> causes error: >>>> /home/space/devel/sole/sola/spec/lib/backup/status_spec.rb:4:in `<top >>>> (required)>': uninitialized constant Backup (NameError) >>>> >>>> Thanks in advance... >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "rspec" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/rspec/49a5a495-cc57-4906-b69f-b3589319cc7b%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/rspec/49a5a495-cc57-4906-b69f-b3589319cc7b%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "rspec" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] <javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rspec/ccc09de7-a485-4ce4-a24c-7c6038df59c4%40googlegroups.com >> >> <https://groups.google.com/d/msgid/rspec/ccc09de7-a485-4ce4-a24c-7c6038df59c4%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/f5276a7d-2625-4991-981f-7aeb85dd795d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
