...You can use Object#method to obtain a method reference that responds to #call: foo_plus = "foo".method(:+) foo_plus.call("bar") # => "foobar" The method reference also understands #to_proc so you...
...quote attribute values or you will get a Nokogiri parsing error like this: unexpected 'foo' after 'equal' (Nokogiri::CSS::SyntaxError...
The step we used in the past (Then "foo" should not be visibile) doesn't reliably work in Selenium features. I overhauled the entire step so it uses Javascript to...
...before the # character (but newline is allowed) <%# this works as expected %> <% # this works, too # foo bar baz...
Give your iframe a name attribute (i.e. ) and then simply use When I press "Foo" in the iframe "myframe" Then I should see "Bar!" in the iframe "myframe"
...the beginning and end of a word instead: SELECT * FROM notes WHERE title REGEXP "[[:<:]]foo[[:>:]]" These markers are unique to MySQL and not available in Ruby regular expressions...
...in slug generator since Rails 2.2: > "What Up Dog".parameterize => "what-up-dog" > "foo/bar".parameterize => "foo-bar" > "äöüß".parameterize => "aouss" Also see: Normalize characters in Ruby...
...Capybara.ignore_hidden_elements = false # find all elements (hidden or visible) page.all(".articles .article[id='foo']") # find visible elements only (overwrite the standard behavior just for this query) page.all(".articles .article...
...id='foo']", :visible => true) # changing the default behavior (e.g. in your features/support/env.rb file) Capybara.ignore_hidden_elements = true # now the query just finds visible nodes by default page.all(".articles .article[id...
How to define and call class methods in CoffeeScript classes: class Foo @classMethod: -> @otherClassMethod() instanceMethod: -> @otherInstanceMethod() @constructor.classMethod...
10.0.0.1.xip.io resolves to 10.0.0.1 www.10.0.0.1.xip.io resolves to 10.0.0.1 mysite.10.0.0.1.xip.io resolves to 10.0.0.1 foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1 ...and so on. You can use these domains to access virtual hosts...
...whole libvirtd service. But you can just reload corresponding domain xml too: $ virsh define foo.xml
A workaround is to use grep with find: find ./ -type f -exec grep "foo...
...but not as part of the whole test suite, make sure the filename is foo_spec.rb instead of just foo.rb...
FileUtils.touch 'example.txt' You may also pass an array of filenames: FileUtils.touch %w[ foo bar baz ], :mtime => Time.now - 2.hours Non-existent files will be created...
...which IE fails to support properly. Example Consider the following HTML and CSS. foo bar .container { display: flex; flex-direction: column; } .child { flex: 1; } See it in action at Plunker...
Let's say you want a transform that replaces substrings like "translate:foo" by the I18n translation for "foo". This transform will incorrectly discard characters left and right...
...from "translate:foo": Transform /\btranslate:(.+?)\b/ do |key| I18n.t(key) end A more correct version of that transform would be this: Transform /^(.*?)\btranslate:(.+?)\b(.*?)$/ do |left, key, right| left + I18n.t...
...for my own reference, of a few ways to easily delete the dot-underscore (._foo, ._bar, etc.) files created by (badly-behaved) Mac OS X systems on non-AFP server...
...are three solutions for you. Easiest solution Rethink! Do you really need CONSTANT = %w[foo bar] to be constant? In many cases, setting it as a simple attribute will do...