-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added "request" specs type #20
base: master
Are you sure you want to change the base?
Conversation
end | ||
RSpec.configure do |config| | ||
config.include RSpec::Hanami::Matchers, type: :request | ||
config.include RSpec::Hanami::RequestHelpers, type: :request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not use that it's correct lines.
We use RequestHelpers helper in feature
types spec. And Matchers
in action
, view
, entity
and other types.
Could you fix it before merge please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little bit confused by
And Matchers in action, view, entity and other types.
Here is my suggestion:
config.include RSpec::Hanami::RequestHelpers, type: :request | |
RSpec.configure do |config| | |
config.include RSpec::Hanami::RequestHelpers, type: :request | |
config.include RSpec::Hanami::RequestHelpers, type: :feature | |
config.include RSpec::Hanami::Matchers, type: :request | |
config.include RSpec::Hanami::Matchers, type: :action | |
config.include RSpec::Hanami::Matchers, type: :view | |
config.include RSpec::Hanami::Matchers, type: :entity | |
end |
What are other types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I found another one unexpected behavior: when I'm require matchers and run all tests some tests expects from subject to be an array (rack-response)
subject { interactor.() }
it { expect(subject).to be_success }
with error message
NoMethodError: undefined method `first' for #Hanami::Interactor
This error is referenced to Hanami::Matchers::BeStatus
Looks like matchers should be refactored, or be included in individual order by spec-types
Code for #14
Including gem functionality by specifying
type: :request
in rspec'sdescribe
block