Skip to content

Instantly share code, notes, and snippets.

View PareshGupta's full-sized avatar

Parry Gupta PareshGupta

  • Vinsol | Stadium
  • New Delhi
View GitHub Profile
@PareshGupta
PareshGupta / Capybara.md
Created May 22, 2018 07:21 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
@PareshGupta
PareshGupta / mysql.database.yml
Created January 21, 2018 18:39 — forked from jwo/mysql.database.yml
Sample config/database.yml from Rails. Postgres, MySQL, and SQLite
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
@PareshGupta
PareshGupta / install_chrome_driver
Created September 28, 2017 20:21 — forked from thotmx/install_chrome_driver
Install chromedriver in Ubuntu (14.04)
$ sudo apt-get install chromium-chromedriver
$ sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/chromedriver
@PareshGupta
PareshGupta / spec_helper.rb
Created April 1, 2016 07:49 — forked from pauljamesrussell/spec_helper.rb
RSpec matcher for ensuring a model is accepting nested attributes for an association, and accepting/rejecting the right values.
# Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })}
RSpec::Matchers.define :accept_nested_attributes_for do |association|
match do |model|
@model = model
@nested_att_present = model.respond_to?("#{association}_attributes=".to_sym)
if @nested_att_present && @reject
model.send("#{association}_attributes=".to_sym,[@reject])
@reject_success = model.send("#{association}").empty?
end
model.send("#{association}").clear