...that gets ugly and/or annoying once you require more than just a simple method call, e.g. with many arguments that are required for a method for some reason.
...why this works is because RSpec will evaluate the block assigned for the let call only when result is actually called. This way you can manipulate objects or other data...
In Ruby 1.9, instance_eval calls the block the with receiver as the first argument: In Ruby 1.8, receiver.instance_eval(&block) calls block.call() In Ruby 1.9, receiver.instance_eval(&block) calls...
...up in your face in Ruby 1.9, where a lambda crashes when it is called with a different number of arguments: wrong number of arguments (1 for 0) (ArgumentError)
...to perform the actual HTTP request. The class should cache its results so subsequent calls for the same URLs return the HTML size instantly, without making an additional HTTP request...
When a Ruby block or proc takes multiple parameters, and you call it with an Array, Ruby will unexpectedly splat the array elements: block = proc { |a, b| "a=#{a}, b...
...object1, object3, object2] moveArrayElement(list, object2, -2) // list => [object2, object1, object3] Note that any calls which move elements beyond the array's boundaries are ignored. It was what I needed...
original_hash # => { foo: { bar: "original value" } How it works: #deep_dup simply calls itself recursively for arrays and hashes and calls #dup for all other Objects where #duplicable...
...should help you out: Bundler actually doesn't automatically require anything. You need to call Bundler.require(:default, :your_custom_group1, ...) for that. The reason why you never had to write...
...in your spec folder (like has_defaults), and you boot its environment, it should call Bundler.require for you and you don't need to require anything yourself. If your embedded...
...it if that is the case. You can use the following trait and always call send_file_inside with the parent directory of the files as the first parameter, like...
...to Capybara::RackTest WARNING: Using 'Given/When/Then' in step definitions is deprecated, use 'step' to call other steps instead Replace Given/When/Then/And/But methods within your step definition steps with the step-method...
...removed and some kind of replaced by native. Normally you don't need to call .native on a node (e.g. found by page.find(selector)). # old element.node.attribute("title").value field.value
...than it sounds. First, prepare your certificate store. Note that it is essential to call set_default_paths to include your system's default certificate store which contains root CAs...
...searchable API documentation. Filled with code examples. Easily customizable: specify toolbar buttons, pass various callbacks, etc. Features a collection of great plugins. Easily extendable by self-made plugins. It is...
...documentation states that allowedTags is processed upon paste, it actually is not. So we call Redactor's removeTags for this. However, settings.allowedTags also contains all sorts of tags that we...
...they use Rational representation internally. >> (Date.tomorrow - Date.yesterday).to_s >> "2/1" Sure, you could just call to_i on that, but often times the results of such subtractions go into a...
...for example), just manually do what the method does by using 2 alias_method calls. Here is a spec that goes along with the fix: require 'spec_helper' describe Rational...
end def cookies redirect_to '/' end end If you create an action called cookies, any call to the cookie storage will be broken and call the method. What...
...s more, in this example calls to static_pages_controller#imprint might as well end up redirecting to the homepage. Solution Just define the action as cookies_action or similar...
...database dump every time you deploy: before 'deploy', 'db:dump' This will not be called for cap deploy:migrations. The same applies to other things that are hooked similarly, like...
When looking at the default deploy recipe mind those three tasks: Task name Called tasks Note :update update_code, then symlink Clones a new release, symlinks it to current...
...click a link or a press a button on a Selenium-controlled browser, the call will return control to your test before the next page is loaded. This can lead...
...to concurrency issues when a Cucumber step involves a Selenium action and a Ruby call which both change the same resources. Take the following step which signs in a user...
...at the wrong location, you can rename the requiring CSS file to .css.scss, turn calls to url into font-url (requires SASS) and pass a valid path to that font...
...Capybara API is somewhat hard for parse for a list of methods you can call on a Capybara node. Below you can find such a list. It's all copied...
...whatever you scoped to by saying within(selector) {...
...}. You can select child notes by calling page.find(selector) or page.all(selector). You can call the same list of methods on child...
...Geordi: cuc features/focus_issues.feature features/flickering_tests.feature Be careful not to use a line number in the call. Tests will not run in parallel when a line number is used. Observe how each...
...if you are using Geordi support for headless Selenium with VNC you need to call cuc-show to see the Firefoxes). Make sure that the window opened by focus_issues.feature stays...
...code, you will need to run multiple threads. Unfortunately, when you use blocking system calls (e.g. locks on the database), Ruby 1.8 threads won't work because system calls will...
...entities? "return" returns from closure True closure? or declaring context...? Arity check? --------------- ----------------------------- ------------------- 1. block (called with yield) N declaring no 2. block (&b => f(&b) => yield) N declaring no...
...semantically identical -- that is, they're different syntaxes for the same thing: 1. block (called with yield) 2. block (&b => f(&b) => yield) ------- 3. block (&b => b.call) 4. Proc.new...
should find tools by model and maker should find tools by serial number Call RSpec like this in order to use the nested format: spec spec -f documentation
...that run without Rails. When you work on a production Rails console, you can call Rails.logger.flush to write log output...
...outfile out.pdf one.pdf two.pdf Pages from joined documents might be rotated. To avoid this, call it like this: pdfjam --outfile out.pdf --fitpaper true --paper a4paper --rotateoversize false one.pdf two.pdf
...lib/rack/cookie_stripper.rb. module Rack class CookieStripper ENABLED = false def initialize(app) @app = app end def call(env) Request.new(env).cookies.clear if ENABLED @app.call(env) end end end Next, configure your application...