it 'does something' do pending end it 'does something else' do pending expect(1).to eq(1) end The first case may be unexpected, if you just wanted to...
...it properly or you will "randomly" get errors like these: wrong number of arguments (1 for 0) (ArgumentError) wrong number of arguments (0 for 1) (ArgumentError) Take a look at...
def tp(objects, *method_names) terminal_width = `tput cols`.to_i cols = objects.count + 1 # Label column col_width = (terminal_width / cols) - 1 # Column spacing Array(method_names).map do...
...cells.map{ |cell| cell.to_s.ljust(col_width) }.join ' ' end nil end Usage examples: tp Video.where(key: '123'), :created_at, :updated_at, :published tp [album1, album2], :title, :image_count
...ve forked it so it works for Rails 2.3.x applications running on Ruby 1.9. [1] makandra/mongomapper is based on the "official" rails2 branch [2] which contains commits that were...
...added after 0.8.6 was released. Tests are fully passing on our fork for Ruby 1.8.7, REE, and Ruby 1.9.3. To use it, add this to your Gemfile: gem 'mongo_mapper...
I had this error: > gem install bundler Successfully installed bundler-2.0.1 1 gem installed > bundle install Traceback (most recent call last): 2: from /home/henning/.rbenv/versions/2.5.1/bin/bundle:23:in ` ' 1: from /home/henning/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb...
...Probably missing gem: ' + gem_name print 'Auto-install it? [yN] ' gets.strip =~ /y/i or exit(1) system(install_command) or exit(1) # retry Gem.clear_paths puts 'Trying again ...' require gem_name...
...By default, output is sorted by directory name, not size: du -h --max-depth=1 . 40K ./a 2.3G ./b 3.1M ./c 500M ./d 2.8G .
...h switch does the magic of understanding humanized size formats): du -h --max-depth=1 . | sort -h 40K ./a 3.1M ./c 500M ./d 2.3G ./b 2.8G .
A haml angular 1 template with .thing(class="is-{{:: item.type }}") will be compiled (by haml) to which is not what you want! It will also crash in angular (unless thing...
...with Error: [$parse:syntax] Syntax Error: Token 'thing' is an unexpected token at column 11 of the expression [item.type thing] Solution 1: Use ng-class instead of class
...linked article shows what current browsers do when you click a link like this: 1-562-867-5309 Spoiler: The current state is sad It's still the case that...
...warning Integrity check: System parameters don't match error Integrity check failed error Found 1 errors. ======================================== Your Yarn packages are out of date! Please run `yarn install --check-files` to...
def scenario_ended return unless session.driver.is_a?(::Capybara::Selenium::Driver) self.driver_scenario_count += 1 if !browser_died? && driver_scenario_count >= MAX_SCENARIOS_PER_DRIVER kill_session! end end
end end class CustomHttpClient < Selenium::WebDriver::Remote::Http::Default def initialize(open_timeout: 10, read_timeout: 60) super end private def response_for(request) if Reaper.browser_died? raise 'Waiting...
...date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch..merge in git-config(1...
...the following to your ~/.bashrc: export CDPATH=.:~/.bookmarks/ function mark { ln -sr "$(pwd)" ~/.bookmarks/"$1" } # Always resolve symbolic links (e.g. for bookmarks) alias cd="cd -P" This will add a...
In shell scripts you can use $1 to refer to the first argument, $2 for the second, etc. If you want to refer to all arguments (e.g. when writing a...
...and passes them on to another call), you may not want to do a “$1 $2 $3 $4 ...”. Use $@ instead, like in this script: $ cat welcome #!/bin/bash
...as #html_safe will lead to unexpected behavior. E. g. backreferences to captured groups ($1, $2) will be nil even if the group was matched. There is no universal workaround...
...to still be safe after using gsub on them. You can, however, fix the $1 gsub behavior on html_safe strings...
...1,2,3,4].sample # => e.g. 4 If you'd like to cheat and give different weights to each element in the array, you can use the attached initializer to...
[1,2,3,4].weighted_sample([1,1,1,1000])
def all_tags virtual_tags + tags end end > Post.new.virtual_tags => [] # ✔ > Post.find(1).virtual_tags => nil # ☹ > Post.find(1).all_tags => Error: undefined method '+' for nil:NilClass
...file to use them (for example like this): file = @attachment.file.path file_extension = File.extname(file)[1..-1] options = {} options[:type] = Mime::Type.lookup_by_extension(file_extension).to_s send_file file...
If you're experiencing problems with your Google Chrome installation after an update, it might help downgrading Chrome to check...
When used to do: $> cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Xeon(TM) CPU 3.00GHz stepping : 1
...Instead, on Solaris, use psrinfo(1M) $> psrinfo -v Status of virtual processor 0 as of: 09/17/2006 21:45:32 on-line since 08/24/2006 16:16:03. The i386 processor operates...
...and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/ $ cat ./docker-compose.yml
...remove docker-compose. Check your docker-compose version $ docker-compose --version docker-compose version 1.17.1, build unknown $ docker-compose version docker-compose version 1.17.1, build unknown docker-py version...
...object, Ruby calls #to_a on the object: o = String.new('O') def o.to_a [1,2,3] end a, b, c = o # Implicit call to #to_a here
...can manually calculate the quarter index like (Date.parse('2011-02-10').month / 3.0).ceil #=> 1 Yes, you do actually divide by 3.0, not 4.0. MySQL has SELECT QUARTER...
...1...
...other request like from ActionCable. Then just set the maximum number of workers to 1 and the other requests have to wait. UNICORN_WORKERS=1 rails server