Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
NYC Standup: 2/5-10 Batched

Interesting

  • assert_template Matching: RSpec’s template matcher uses a reg ex, which is loose enough to cause some false positives.
  render "_foo_bar.haml"

will pass cause both of these to pass:

  should render_template "_foo_bar.haml"
  should render_template "_bar.haml"

The best solution presented was to explicitly say what you expect not to be rendered(should_not render_template “_bar.haml”). There has been some activity on Github recently around ActionController’s assert_template method, but none addressing this exact problem(1 example: https://github.com/rails/rails/pull/3879/files). The regex is complicated by the fact that it has to match ambiguous partials rendered with specific paths(should render_template “_bar.haml” needs to match render “foo/_bar.haml”).

  • Let It Be: If you declare a “let!” variable at the top of a file, and redeclare that variable with a “let” statement in a nested context, the variable will not be lazily loaded. RSpec evaluates it as a “let!”.

  • Binary Tempfiles: There is no way to open a new Tempfile in binary mode; you must open it first and then call foo.binmode.

  • Airbrake was acquired by Exceptional
    http://techcrunch.com/2012/02/07/exceptional-acquires-error-tracking-application-airbrake/

  • Auto compiling SASS, pre-3.0: Adam used ‘compass watch’ and Foreman to automate the regeneration of stylesheets in development. This prevents him from having to wait for the sass to recompile on the first request he makes after modifying stylesheets. https://github.com/ddollar/foreman

  • Should receive, in any order: Ian & Suman were attempting to write an RSpec 1.3 spec that asserted a method was called with an array that included the correct elements; however, the order of the elements within the array was not important. Seems there is no array_including equivalent to hash_including. The solution they came to was to use the block style expectation as defined here: https://www.relishapp.com/rspec/rspec-mocks/docs/argument-matchers

  foo.should_receive(:bar) do |arg1|
    arg1.should =~ [3,1,2]
  end

Anyone know of a built-in matcher for arrays similar to hash_including?

Comments
  1. RE compiling assets, I used to use guard-rails-assets which can run as embedded and is lighting fast then: https://github.com/dnagir/guard-rails-assets

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *