iFrame you frame…

February 5, 2013 George Dean

Helps

undefined method `fields' for nil

We keep getting this error across multiple projects & machines, with different versions of the pg gem and the PostgreSQL server, with varying consistency. Switching the tests to sqlite seems to fix it.

Failure/Error: Unable to find matching line from backtrace
ActiveRecord::StatementInvalid:
  NoMethodError: undefined method `fields' for nil:NilClass: SELECT "locations".* FROM "locations"  WHERE "locations"."id" IN (11, 10, 5, 4, 1, 3, 2)

It appears that PG::Connection#async_exec is returning nil for some queries.

It was suggested to add a "fields" method for the nil class.

Interestings

Homebrew is Kickstarting an automated test bot

http://www.kickstarter.com/projects/homebrew/brew-test-bot £50 to get a pair of pint glasses…

Resizing the window to test media queries

If you want to test your media query css as part of your acceptance suite, you can just ask Capybara to resize the firefox window.
Don't use the iframe to do this, because it will be buggy. Note you will need to use min/max-width not min/max-device-width when defining your media queries. Otherwise resizing the browser window will not trigger the media query.

Capybara.current_session.driver.browser.manage.window.resize_to(width, height)
Capybara.current_session.driver.browser.manage.window.position = Struct.new(:x, :y).new(session_name == :default ? 0 : width, 0)

Thanks to Ryan for the tip.

About the Author

Biography

More Content by George Dean
Previous
2013 Tracker Update – New Features, New API, New Design
2013 Tracker Update – New Features, New API, New Design

January has gone by quickly! Hopefully the new year is already off to a great start for you and your entire...

Next
Tracker Ecosystem: CloudWork – Making cloud apps work together better
Tracker Ecosystem: CloudWork – Making cloud apps work together better

With all these APIs floating around don’t you sometimes wish that apps would just talk to each other and k...

Enter curious. Exit smarter.

Learn More