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

Cell is rendered as escaped text in Cucumber test #378

Open
lessless opened this issue Feb 14, 2016 · 7 comments
Open

Cell is rendered as escaped text in Cucumber test #378

lessless opened this issue Feb 14, 2016 · 7 comments

Comments

@lessless
Copy link

Hello,

During Cucumber tests cell's content is rendered as escaped string http://cl.ly/0I0G0c3k2c0i.
Gem versions are:

cells (4.0.4)
capybara (2.5.0)
cucumber (1.3.20)

May have relation to trailblazer/rspec-cells#21 but this happens within cucumber, not RSpec tests

@apotonick
Copy link
Member

Is that a Cucumber test that only tests a cell in isolation, or retrieves the page via the controller, e.g. GET /comments?

@lessless
Copy link
Author

@apotonick it's the later, with visit new_realty_path

@lessless
Copy link
Author

btw, in both development and test environments, i.e. when called during regular navigation with a browser and when called during the visit helper inspired request, cell renders the same string.
Also template engine doesn't matter - it's the same for erb and slim.

"<form class=\"simple_form large-9 larger-centered medium-10 medium-centered small-12 columns\" id=\"new_realty\" action=\"/manage/realties\" accept-charset=\"UTF-8\" method=\"post\"><input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" />\n  \n\n  <div class=\"form-section small-12 colunms\">\n    <div class=\"row\">\n      \n        <div class=\"input hidden realty_listing_deal\"><input value=\"rent\" class=\"hidden\" type=\"hidden\" name=\"realty[listing_attributes][deal]\" id=\"realty_listing_attributes_deal\" /></div>\n        <div class=\"input string required realty_listing_price medium-6 small-12 columns\"><label class=\"string required\" for=\"realty_listing_attributes_price\">Price <abbr title=\"required\">*</abbr></label><input class=\"string required\" required=\"required\" aria-required=\"true\" placeholder=\"Price\" type=\"text\" name=\"realty[listing_attributes][price]\" id=\"realty_listing_attributes_price\" /></div>\n</div></div>\n</form>"

update:
eventually, marking string as html safe helped to put tags on screen

= concept('realty/cell/create', @form).to_s.html_safe

@thedanielhanke
Copy link

i had the same issue when calling = cell(:foo, model) instead of (really!) =cell(:foo, model).()

@chrisyeung1121
Copy link

same issue here.

@apotonick
Copy link
Member

@thedanielhanke Are you very very very sure that this is the case? This would mean that the override in call works, but the ViewModel#to_s method is not invoked.

Can anyone override the to_s method and raise an exception to see if it is called or not?

@thedanielhanke
Copy link

@apotonick sorry for the delay. it does not happen anymore, iirc it was a result of slim, caching and omitting .() but i cannot reproduce it now.

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

No branches or pull requests

4 participants