Skip to content

Instantly share code, notes, and snippets.

@yhara
Last active December 19, 2015 11:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhara/5949691 to your computer and use it in GitHub Desktop.
Save yhara/5949691 to your computer and use it in GitHub Desktop.

#383 - July 2, 2013

Olivier Lacan, Tony Winn

One Liner Webserver (0:30-)

Nobuyoshi Nakada showed a beautifully simple way to start a web server within the present working directory by only using Ruby. ruby -run -e httpd . -p 5000

  • I know this is the(?) exchange between Aaron Patterson and Nobuyoshi Nakada, both Ruby core contirbutors yesterday on Twitter, Nobuyoshi showed beautifully simple way to start a web server within the present working directory by only using ruby.
  • You mean something like that single-line Python script that was floating(?) around?
  • Yeah, exactly. All you need to do is call ruby -run -e httpd . -p 5000. That will start the server using WEBrick, which comes with(?) the Ruby Standard Library, and you can see the server running at localhost:5000 in your brouser(?), if you have an index.html file in that directory, it will show up in your browser.
  • That's a really neat trick especially for prototyping with static HTML files.
  • Exactly.

Writing Better Controllers (1:15-)

Damien Le Berrigaud of Pivotal Labs wrote up an interesting blog post this weekend about refraining from using mocks and stubs when testing controllers to foster object-oriented design.

  • Hey Olivier, how do you say this name?
  • "Damian Le Berrigaud".
  • Um, "Damian Le Berrigaud"?
  • Yes.
  • ... of Pivotal Labs wrote up an interesting blog post this weekend about refraining from using mocks and stubs when testing controllers to foster object-oriented design.
  • It's interesting because people seems to be moving away from testing controllers in favor of unit or integration tests, and he's talking about controller tests, right?
  • That's right, here are(?) use about static methods stubbing with any instance of an object that is a smell and goes on to refactor his controller logic into a class method first, and then on to its own service.
  • That sounds a lot like kind of refactoring we've been doing on Code School recently, and we found it to be very benefitial for both test speed(?) and separation of concerns to do that kind of stuff.
  • Totally.

verified_double (2:04-)

George Mendoza let us know about verified_double, a contract based mocking library he’s been working on that integrates with rspec.

  • Tony, do you think mocking is evil?
  • Do I think mocking is evil? It depends on what you mean, I think mocks can be dangerous. Evil...? Probably(?) goes too far.
  • Yeah, I guess that will be a reasonable way to ask that question.
  • Then yeah, I think mocks are very useful to isolate our unit test, but if you don't have an integration test in place then you can give you force(?) confidence in your code.
  • Oh the sweet green lies(?). What George Mendoza let us know about verified_double, an mocking library he's been working on, that integrates with RSpec and doesn't allow you to lose yourself lying mocks.
  • That sounds pretty similar to rspec-fire(?), which calls the mock to methods on the objects to verify that they respond them. How is this different?
  • You basically setup contract within your specs using the RSpec tag syntax. If the object you're mocking doesn't have a spec that backs up this contract, then verified_double will warn you that you're in trouble basically.

Building a mocking library (2:56-)

Andy Lindeman's fantastic talk from Ancient City Ruby on Building a mocking library has been released.

  • Speaking of mocking libraries, a fantastic talk by Andy Lindeman from Ancient City Ruby 2013 is now available on YouTube.
  • This is by far the best livecoding talk that I've ever seen.
  • Yeah, and it's especially useful if you don't have clear grasp of what mock can do for you, or if you don't understand how powerful a really fast red-green refactor cycle can be.

Is my gem ready for Rails 4? (3:18-)

Francesco Rodríguez and Florent Guilleux teamed up to create ready4rails4.net where you can find out wether a gem is compatible with Rails 4 or not.

  • Earlier this year, I said using Rails 4 beta on a small project we use internally and we couldn't use the haml-rails gem because it had a strict dependency on older verisons of Rails.
  • Yeah, it's always frustrating when a new major version of Rails comes along and many of the popular gems have to take a little while to catch up. I had a similar thing happen on devise which now requires you to use a branch on github for it to work.
  • Thanks to Francesco Rodríguez and Florent Guilleux, we don't have to live through so much pain anymore. They teamed up to create ready4rails4.net, where you can find out whether a gem is compatible with Rails4 or not.
  • You can even paste your existing Gemfile and see detailed information about each gem, people have(?) even provided notes pointing to pull request if Rails 4 compatibility is worked on for specific gem.
  • Since it's community site, feel free to report whether gems you created, or gems you use, are compatible or will be soon.

Open source contributions around the world (4:14-)

David Fischer submitted a really neat tool to GitHub’s Data Challenge recently: a map of the world where he plotted all the open source contributors to the 200 most active GitHub repos in the first four months of 2013.

  • David Fischer submitted a really neat tool on GitHub's Data Challenge recently, a map of the world where he plotted all the open source contributions of the 200 most active GitHub repos in the first four months of 2013.
  • A site(?) from the heart-warming effect seem so many open source contributors, it's really cool to zoom in on a map and see what your projects contributed to in cities close to you, and who are the people who contribute the most.
@willnet
Copy link

willnet commented Jul 10, 2013

awesome!

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