...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)
Solution 1 Use the keyword argument allow_label_click: true within the method call. So instead of check('Some label'), use check('Some label', allow_label_click: true).
...Perhaps you ran into ActionView::MissingTemplate error and this card might help. If you call render_to_string within the format.json block, Rails will only look for an index.json template...
...Memoized methods are now faster at runtime. This will only be noticable if you call a memoized methods many times in the same request. We published our fork as a...
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...
...as if each line-box starts with a zero-width character (that the spec calls a strut) vertical-align:middle is never really “at the middle” An inline element has...
...ps2eps is actually just a wrapper around the GhostScript tool gs. Technically, you can call gs yourself, but ps2eps does lots of magic for you (it's a Perl script...
...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...
...Then, up.destructor would register the destructor function on the detached element, but Unpoly never calls that destructor and your application effectively leaks memory. In almost all cases you can avoid...
...0x00007f55f023c6f0 @attributes=[:partner_id, :name], @options={}>, #<ActiveRecord::Validations::UniquenessValidator:0x00007f55f1417e88 @attributes=[:name], @klass=UserGroup (call 'UserGroup.connection' to establish a connection), @options={:case_sensitive=>true, :scope=>:partner_id}>, #<ActiveModel::Validations::NumericalityValidator...
...0x00007f55f023c6f0 @attributes=[:partner_id, :name], @options={}>, #<ActiveRecord::Validations::UniquenessValidator:0x00007f55f1417e88 @attributes=[:name], @klass=UserGroup (call 'UserGroup.connection' to establish a connection), @options={:case_sensitive=>true, :scope=>:partner_id...
...methods are stored. include: Adds methods from the provided Module to the object extend: Calls include on the singleton class of the object Further reading After you understood include and...
...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
TestCase::TargetLimitation debugger
This will leave you with a mess of calls to the class that has to be maintained and be cleaned up in the future...
...not to modify an array that you received as a method argument as the caller might not expect changes to it...
...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...
...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...
...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...
...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...
...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...
...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...