Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added "request" specs type #20

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 22, 2018

Code for #14

Including gem functionality by specifying type: :request in rspec's describe block

end
RSpec.configure do |config|
config.include RSpec::Hanami::Matchers, type: :request
config.include RSpec::Hanami::RequestHelpers, type: :request
Copy link
Owner

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Author

@ghost ghost Dec 25, 2018

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:

Suggested change
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?

Copy link
Author

@ghost ghost Dec 26, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants