Skip to content

Conversation

@nevinera
Copy link
Contributor

The <%= erb syntax escapes strings for html purposes, which means that the data attribute was receiving a string filled with &quot;s and such. Instead we should use <%==. The produced json will contain double-quotes, so the attribute should be set in single quotes.

visit '/swagger'
page_options_json = page.evaluate_script("$('html').data('swagger-options')").to_json
expect(page_options_json).to eq(@options.marshal_dump.to_json)
end
Copy link
Member

@dblock dblock Apr 27, 2016

Choose a reason for hiding this comment

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

It's a good spec, but it doesn't fail before the code change, you need another one that demonstrates the fix for the bug you're fixing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That one should have, I didn't realize that jquery unescapes html entities when processing a data tag. So there was no bug, except that the contents of the <html> tag were difficult to read.

@dblock
Copy link
Member

dblock commented Apr 27, 2016

Please also update CHANGELOG.

@nevinera
Copy link
Contributor Author

No bug after all, I'm going to close this.

@nevinera nevinera closed this Apr 27, 2016
@dblock
Copy link
Member

dblock commented Apr 27, 2016

👍

Is the test useful though? Or do we already have something similar? If not do PR it please.

@nevinera
Copy link
Contributor Author

You were already testing that various specific options has correct impacts,
which would have caught any such problem.
On Apr 27, 2016 3:38 PM, "Daniel Doubrovkine (dB.) @dblockdotorg" <
notifications@github.com> wrote:

👍

Is the test useful though? Or do we already have something similar? If not
do PR it please.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#51 (comment)

@dblock
Copy link
Member

dblock commented Apr 27, 2016

It would, but this is a more specific test. I think it's useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants