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
How to override a function in rails from Yuhuda Katz. I'm new to ruby and this always confuses me. nice to have a good example from a guru. | |
class Foo < ActiveRecord::Base | |
include FooBar | |
end | |
module FooBar | |
def self.included(base) | |
base.extend(ClassMethods) | |
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
### /etc/default/rails ### | |
APP_USER=vagrant | |
RVM_SETTING="1.9.3-p125@rails32" | |
RAILSDIR=/home/vagrant/rails | |
# Example: STAGES=("vagrant_staging", "vagrant_production") | |
STAGES=("vagrant_staging") | |
# Example APPS=("myapp1" "myapp2") | |
APPS=("myapp") |
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
#app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
def opensearch | |
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8' | |
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
runtime bundle/pathogen/autoload/pathogen.vim | |
call pathogen#infect() | |
call pathogen#helptags() | |
syntax on | |
filetype plugin indent on | |
set number | |
set tabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set textwidth=80 |
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
## /spec/support/mock_geo.rb | |
## MockGeo takes an address in the following format and can produce | |
## fake google geocode output | |
## All country and state information resolves to North Carolina, USA | |
## Include "gem jbuilder in :test and :development group" if not already in the project. | |
## Example | |
## Output for address string *MUST* be in this format | |
## a = '102 My Street, My Town, , NC, 99903' OR | |
# a = '102 my street, my town, nc' | |
## b = MockGeo.new(:addr => a) |
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
When /^I click the clear search button$/ do | |
find('#search_icon').click | |
end | |
Then /^the search field should be focused$/ do | |
page.execute_script <<-JS | |
if (jQuery('#search_form input[type=search]').is(':focus')) { | |
jQuery('#search_form').append("<div id='search_form_is_focused' />"); | |
} | |
JS |
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
*/.gitkeep | |
tmp/ |
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
# feature/support/login_helper.rb | |
require 'spec/support/login_helper' | |
Before do | |
extend LoginHelper | |
@user = FactoryGirl.create(:user) | |
login_as @user | |
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
#spec/support/capybara.rb | |
require 'capybara/rspec' | |
# Using chrome as browser to test in capybara. | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
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
context 'my element' do | |
before do | |
a =<< EOF | |
jQuery -> | |
$('body').append('<div id=empty_or_hidden_element></div>') | |
EOF | |
page.execute_script CoffeeScript.compile(a) | |
end | |
it 'should not be displayed' do |
OlderNewer