This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call scopes directly from your URL params: | |
# | |
# @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Call the class methods with the same name as the keys in <tt>filtering_params</tt> | |
# with their associated values. Most useful for calling named scopes from |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IMPT: | |
# Configure ENV['LOG_LEVEL'] to be one of DEBUG, INFO, WARN, ERROR, FATAL | |
# figure out where we are being loaded from | |
if $LOADED_FEATURES.grep(/spec\/spec_helper\.rb/).any? | |
begin | |
raise "foo" | |
rescue => e | |
puts <<-MSG | |
=================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DefaultValues | |
def has_default_values(default_values = {}) | |
cattr_accessor :default_values | |
self.default_values = default_values | |
after_initialize :assign_default_values | |
include InstanceMethods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `brew install chromedriver` or `gem install chromedriver-helper` | |
# or download latest from https://code.google.com/p/chromedriver/downloads/list | |
if Selenium::WebDriver::Platform.find_binary "chromedriver" | |
Capybara.register_driver :selenium do |app| | |
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => [ "--start-maximized" ]}) | |
$driver = Capybara::Selenium::Driver.new(app, {:browser => :chrome, :desired_capabilities => caps}) | |
end | |
Capybara.configure do |config| | |
config.default_driver = :selenium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extend 'activesupport/lib/active_support/descendants_tracker.rb' | |
# to add `Model.all_descendants` method | |
# | |
# This preloads the STI Models of a Class and retrieves all the nested descendants | |
# If you are storing the model list as a constant add this at the end of the parent model file: | |
# | |
# Rails.application.config.after_initialize do | |
# # Dynamic list of all STI descendants | |
# MODEL_LIST = Model.all_descendants.map(&:name) | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
#=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click_on('Button Value') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install Linux updates, set time zones, followed by GCC and Make | |
sudo yum -y update | |
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \ | |
/etc/localtime | |
sudo yum -y install gcc make | |
2. Download, Untar and Make Redis 2.8 (check here http://redis.io/download) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Copy and paste the following in ~/.bash_profile | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[1;34m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" |
OlderNewer