Giter Club home page Giter Club logo

Comments (6)

karlhe avatar karlhe commented on July 29, 2024

What do the contents of that widget look like?

I just tried what you mentioned on one of my simpler widgets and it works fine:

irb(main):020:0> Views::Widgets::Base.new.to_html
=> "<!-- BEGIN Views::Widgets::Base depth 0: :id => (DEFAULT) nil, :element => (DEFAULT) nil, :classes => (DEFAULT) nil -->\n<div id=\"u9iydhwl\" class=\"\">\n</div>\n<!-- END Views::Widgets::Base depth 0 -->"

from fortitude.

alexch avatar alexch commented on July 29, 2024

from fortitude.

jdickey avatar jdickey commented on July 29, 2024

@karlhe, take a look at this Gist that I wrote up and attached the relevant files' contents to, as well as the error dump that prompted filing of this issue.

Note the update at the bottom of the intro, where I document discovery of a workaround that indeed allows me to unit test widgets that yield to blocks if specified — by wrapping the widget of interest in a dummy widget. Ceremonious overkill? Absolutely. Can I think of a better way to do it, that actually works? Nope.

from fortitude.

jdickey avatar jdickey commented on July 29, 2024

Hey, @alexch, how's life? Your questions should be answered by that Gist I linked to in my answer to @karlhe.

from fortitude.

ageweke avatar ageweke commented on July 29, 2024

I'm reopening this, at least temporarily. It strikes me that Fortitude might be breaking #block_given? in a widget context, and that would be bad. At minimum, I want to write some specs around this to make sure it's completely solid (and stays that way). I'll also make sure there aren't some weird situations in which MyWidget.new.to_html doesn't work for some reason. I very much want Fortitude widget testing to Just Work. :)

from fortitude.

ageweke avatar ageweke commented on July 29, 2024

There was, in fact, an issue here underneath: #block_given? always returned true inside a Fortitude widget's content method, whether or not there was any block passed anywhere. Fixed now.

from fortitude.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.