shoes/shoes4 — pull request #250 by arnebrasseur (2013-05-03 20:12:19+00:00)
Title: Pairwithme for a better dsl

Have a look at the commit messages, they are quite complete.

This basically went like this : we started in `lib/shoes/dsl.rb` (formerly known as element_methods), trying to streamline how elements are created. In the new style all elements take the app and the current_slot as their first two arguments, rather than sneaking in a reference to the app in the styles hash. And this boilerplate of passing in those two variables is now in a create method, like so

````ruby
def background(color, opts = {}, &blk)
create Shoes::Background, pattern(color), normalize_style(opts), blk
end
````

In some cases we realized that the DSL method we were trying to clean up didn't have test cases. Since Eric and I spent some time earlier today cleaning up `spec/shoes/dsl.rb`, it was easy to add for instance `spec/shoes/dsl/image.rb`. These specs basically just specify how a certain invocation of the DSL maps to an element constructor.

One of the missing specs was for edit_box, and since I had written an elaborate spec for that one in #227 we took that one in, adapted it to the current structure, and then changed edit_box so the spec went green. Then edit_line had the same problem, so we adapted the spec again to examples shared between edit_line and edit_box, and fixed edit_line so that one as well can take an intial string as an argument.

Thanks to @bjoska for an intensive pairing session, wherein what we thought would be a boring but necessary job, turned into some vary interesting coding!