Coder Social home page Coder Social logo

Comments (6)

gylaz avatar gylaz commented on August 28, 2024

Technically the code above does violate our style guide, since {} are for one-liners, or single line blocks.

from hound.

mrageh avatar mrageh commented on August 28, 2024

You can't use do end in this unless we add a description. How would you rewrite this to
be inline for our style guide?
Thanks in advance @gylaz

from hound.

gylaz avatar gylaz commented on August 28, 2024

You could do (the description is not necessary):

  it do
    should delegate_method(:default_variant_name).
      to(:default_variant).
      as(:name)
  end

Same could be said for expect {}:

expect do
  some_long_method_name_that_does_not_fit_on_one_line
end.to change { something }

# or
expect do
  some_long_method_name_that_does_not_fit_on_one_line
end.
  to change { something }

While I think the first example is fine, the second one is odd. But there isn't really a good solution for the second example without using {}, but then that's breaking consistency of our rules. This might be a good discussion for our guides repo.

from hound.

mrageh avatar mrageh commented on August 28, 2024

Thanks @gylaz, should I start a discussion in the guides repo or do people not mind using a it with no description and do end ?

from hound.

gylaz avatar gylaz commented on August 28, 2024

I think the conversation in guides would be helpful. We should probably figure out where to land with such blocks, especially in the expect situation.

from hound.

salbertson avatar salbertson commented on August 28, 2024

We can reopen the issue when a decision has been made.

from hound.

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.