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
Fix components guide #1281
Fix components guide #1281
Conversation
Invalid yaml was breaking the view
9dde3ad
to
b37c4c3
Compare
@@ -28,31 +28,35 @@ examples: | |||
id: markdown-editor | |||
with_bullet_list_button: | |||
data: | |||
controls: [:bullets] | |||
controls: | |||
- :bullets |
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.
Nice one fixing these 👍
@@ -0,0 +1,13 @@ | |||
require "rails_helper" | |||
|
|||
RSpec.feature "Visit Component Guide" do |
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.
Great stuff adding a test for this.
I was a bit surprised to have it as a feature test but since there isn't a concept of requests tests for this project (instead has the older approach of controller tests) then I agree feature is the place to put this stuff.
require "rails_helper" | ||
|
||
RSpec.feature "Visit Component Guide" do | ||
include ComponentGuideSteps |
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.
It seems superfluous to have a helper file for this. I'd just add any methods into here (as per: https://github.com/alphagov/collections-publisher/blob/master/spec/features/access_control_spec.rb#L42-L62)
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.
Done
RSpec.feature "Visit Component Guide" do | ||
include ComponentGuideSteps | ||
|
||
describe "Component Guide" do |
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.
I don't think you need a describe
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.
Done
scenario "User views the component guide page" do | ||
when_i_visit_the_component_guide_index_page | ||
i_see_a_page_title | ||
i_see_subheadings |
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.
These two assertion seem to actually test parts of govuk_publishing_components gem by checking for HTML and text which the gem provides.
I'd probably just do:
when_i_visit_the_component_guide_index_page
then_i_receive_a_valid_response
end
# ...
def then_i_receive_a_valid_response
expect(page.status_code).to eq(200)
end
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.
Done
b37c4c3
to
cb2916c
Compare
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.
Nice one 👍
This change fixes the components guide endpoint in collections publisher. There was a bug in the yaml file which stopped the guide from rendering, this has now been fixed and a small test added to make sure the components guide loads.