On Thursday, June 26, 2014 11:20:37 AM UTC-7, Roelof Wobben wrote: > > Changed it .See the new commit but now I see this error : > > > > Op donderdag 26 juni 2014 17:49:18 UTC+2 schreef Myron Marston: >> >> On Thursday, June 26, 2014 5:05:55 AM UTC-7, Roelof Wobben wrote: >>> >>> Hello, >>> >>> I follow this tutorial to test my app : >>> http://everydayrails.com/2012/03/19/testing-series-rspec-models-factory-girl.html >>> the only thing I do it different that I use my own app. >>> >>> I did all the steps and at some point I have to do : rspec >>> spec/models/contributie_spec.rb >>> >>> > /home/roelof/rails/wissel-finance/spec/models/contributie_spec.rb:3:in > `<top (required)>': undefined local variable or method `contributie' for > main:Object (NameError) > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `load' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `block in load_spec_files' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `each' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `load_spec_files' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:97:in > `setup' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:85:in > `run' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:70:in > `run' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:38:in > `invoke' > from /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/exe/rspec:4:in `<top > (required)>' > from /usr/local/bin/rspec:23:in `load' > from /usr/local/bin/rspec:23:in `<main>' > roelof@roelof-System-Product-Name:~/rails/wissel-finance$ rspec > spec/models/contributie_spec.rb > /home/roelof/rails/wissel-finance/spec/models/contributie_spec.rb:3:in > `<top (required)>': uninitialized constant Contributie (NameError) > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `load' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `block in load_spec_files' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `each' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/configuration.rb:1057:in > > `load_spec_files' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:97:in > `setup' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:85:in > `run' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:70:in > `run' > from > /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:38:in > `invoke' > from /var/lib/gems/1.9.1/gems/rspec-core-3.0.2/exe/rspec:4:in `<top > (required)>' > from /usr/local/bin/rspec:23:in `load' > from /usr/local/bin/rspec:23:in `<main>' > > > So schould I do require app/models/contributie.rb above the test file or > is there a better solution ? > > Roelof > > >> According to the page I have to see a lot of pending tests. >>> But all I see is this : >>> >>> No examples found. >>> >>> Finished in 0.00028 seconds (files took 0.07798 seconds to load) >>> 0 examples, 0 failures >>> >>> You can see what I have done here : >>> https://github.com/roelof1967/finance >>> >>> Can anyone tell me what went wrong ? >>> >>> Roelof >>> >> >> spec/models/contributie_spec.rb is empty: >> >> >> https://github.com/roelof1967/finance/blob/bda41a49323ecccd7d23801beea9d5a84dec6a06/spec/models/contributie_spec.rb >> >> It looks like you tried to get it to work in spec/contributor_spec.rb: >> >> >> https://github.com/roelof1967/finance/blob/bda41a49323ecccd7d23801beea9d5a84dec6a06/spec/contributie_spec.rb >> >> ...but you'll need to run `rspec spec/contributie_spec.rb` to run that >> spec file. Or you can just run `rspec` and it'll run them all. >> >> Note that for that second file you've got `contributie` (lower case) >> which ruby will treat as a local variable or method call (neither of which >> are defined in this context) so you'll get a `NameError`. I think you want >> `Contributie` (note the capitol C), which is the constant you are >> describing there. >> >> HTH, >> Myron >> >
As I said before: Note that for that second file you've got `contributie` (lower case) which > ruby will treat as a local variable or method call (neither of which are > defined in this context) so you'll get a `NameError`. I think you want > `Contributie` (note the capitol C), which is the constant you are > describing there. -- 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/7baa142c-ca0c-42c9-8de7-2d11ddfc446c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
