I discovered that when I uncomment *begin /end* block in the generated
*spec_helper.rb* file my simple spec fails if I do not use RSpec prefix for
describe blocks as follows:
require 'rack/test'
module ExpenseTracker
describe 'API draft' do
include Rack::Test::Methods
it 'records submitted expenses'
end
end
Error:
An error occurred while loading ./spec/unit/draft_spec.rb.
Failure/Error:
describe *'*API draft*'* do
include *Rack*::*Test*::*Methods*
it *'*records submitted expenses*'*
end
NoMethodError:
undefined method `describe' for ExpenseTracker:Module
# ./spec/unit/draft_spec.rb:4:in `<module:ExpenseTracker>'
# ./spec/unit/draft_spec.rb:3:in `<top (required)>'
No examples found.
Finished in 0.0003 seconds (files took 0.12244 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
If I change the same spec by prefixing describe with RSpec, it works:
module ExpenseTracker
RSpec.describe 'API draft' do
include Rack::Test::Methods
it 'records submitted expenses'
end
end
*expense_tracker* *git:(**unit_tests**) **✗* rspec spec/unit/draft_spec.rb
API draft
records submitted expenses (PENDING: Not yet implemented)
Pending: (Failures listed here are expected and do not affect your suite's
status)
1) API draft records submitted expenses
# Not yet implemented
# ./spec/unit/draft_spec.rb:7
Finished in 0.00194 seconds (files took 0.12484 seconds to load)
1 example, 0 failures, 1 pending
Any ideas why ? Thank you.
--
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/05b92135-d300-4f40-98ea-e7725d6e9fba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.