Recently, we had an interesting lunch-break with the rails 3.1. asset-pipeline in production mode. Daniel Zahn made a blogpost about our journey, precompiling assets, fingerprinting, Haml, Sass & Compass and what he calls "the dark heinous hutch".
You can use the step definition below to say this:
Then the "Last name" field should have an error
Then /^the "([^\"]*)" field should( not)? have an error$/ do |field, negate| expectation = negate ? :should_not : :should page.send(expectation, have_css('.field_with_errors', :text => field)) end
#features/support/examiners.rb After('@leave_the_window_open') do |scenario| if scenario.respond_to?(:status) && scenario.status == :failed print "Step Failed. Press return to close browser" STDIN.getc ...
Gemfile.lockand the listed version is properly installed, something is seriously wrong and needs to be fixed.
bundle install some_gemalthough you wanted
bundle update some_gem
Let's say your
Gemfile asks for
some-gem which you can see when running
gem list but
bundle show some-gem just gives you an error:
Could not find gem 'some-gem', in any of the sources
Another indicator: Doing a `…
Good guide to different ways you can write CSS selectors that select elements by their attribute values.
Consider you have a website vhost listening to
www.example.com, redirecting all incoming requests that do not talk about the configured hostname (this is often used to redirect users to
http://www.example.com when entering only
If you want to make a request to that site's web server without actually talking to
www.example.com (e.g. because this is a load balancer's address but you want to access one specific machine), you cannot just request
localhost as the above vhost will redirect…
These methods are available to you:
page.driver.browser.switch_to.alert.accept page.driver.browser.switch_to.alert.dismiss page.driver.browser.switch_to.alert.text # the confirmation text
Spreewald gives you steps like these:
When I confirm the browser dialog When I cancel the browser dialog
Tell the application controller how to handle exceptions, here a
Do this with the following line:
rescue_from ActiveRecord::RecordNotFound, :with => :render_404
This will call the method
render_404 whenever a
RecordNotFound error occurs (you could pass a
lambda instead of a symbol, too).
Now write this method:
def render_404 render 'errors/404', :status => '404' end
Finally create a 404 document
%h1 Record Not Found .error The record ...
Do you have page caching enabled for the
development environment and there are cached pages lying around in
I recently browsed through the ActiveSupport code and found some nice stuff I did not know about:
Consider this HTML:
<div style="line-height: 42px"> <input type="checkbox" /> </div>
Even though the surrounding container defines a
line-height, which vertically centers its inline elements, the check box will be top aligned if it is the only element inside the container.
It will be aligned correctly if the HTML looks like this:
<div style="line-height: 42px"> <input type="checkbox" /> foo </div>
So the ac…
We have a big flat screen TV (Samsung LE46c650l1kxxu) in our conference room. Configuring it properly, we were encountering some issues.
This is a list of issues, providing a solution to each.
To avoid sending e-mails containing sensitive data unencrypted I strongly suggest you enable a confirmation dialog.
Enigmail can show if the e-mail being sent will be encrypted or not – and if, which keys will be used. This applies to both clicking the "Send" button or pressing Ctrl+Enter. Thus, you may disable the confirmation for the keyboard shortcut as you get a message box anyways which will avoid sending e-mails by accident.
Head over to the Enigmail preferences from the "OpenPGP" menu and tick the corresponding che…
tl;dr: Always have your attachment path start with
The directory where you save your Paperclip attachments should not look like this:
storage/photos/1/... storage/photos/2/... storage/photos/3/... storage/attachments/1/... storage/attachments/2/...
The problem with this is that multiple environments (at least
test) will share the same directory structure. This will cause you pain eventually. Files will get overwritten and…
Select as many rows as you'd like to insert by dragging over the row numbers on the left. Then right-click on any selected row number and select "Insert Rows". Calc will now insert multiple blank rows.
The inserted rows will copy the style from the row above the selection.
This is horrible.
Cross-Origin Resource Sharing (CORS) is a browser technology specification, which defines ways for a web service to provide interfaces for sandboxed scripts coming from a different domain under same origin policy. CORS is a modern alternative to the JSONP pattern. While JSONP supports only the GET request method, CORS also supports other types of HTTP requests. Using CORS enables a web programmer to use regular XMLHttpRequest which supports better error handling than JSONP. On the other hand, JSONP works on legacy browsers that do not have C…
This is now part of geordi. Please don't follow the instructions below, if you use geordi.
Inspired by the recent headless Selenium note, I found yet another solution for the problem to hide your selenium tests away.
This has the advantages
Simply make a script th…
overflowdirectives in your CSS.
<caption>tags in proximity of your table (seriously).