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
# app/validators/reserved_name_validator.rb | |
class ReservedNameValidator < ActiveModel::EachValidator | |
RESERVED_NAMES = %w{ | |
about account add admin api | |
app apps archive archives auth | |
blog | |
config connect contact create | |
delete direct_messages downloads | |
edit email | |
faq favorites feed feeds follow followers following |
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
namespace :source do | |
def find_and_replace_in_source_files(find, replace) | |
puts "Search and replace #{find.inspect} => #{replace.inspect}" | |
files = %w[ .autotest .rspec .rvmrc Gemfile Procfile config.ru ].select{|f| File.exist?(f) } | |
directories = %w[app config lib public script spec test] # exclude bin, db, doc, log, and tmp | |
directories.each do |d| | |
files += Dir[File.join(d, "**/*.{rb,rake,haml,erb,builder,js,coffee,css,scss}")] | |
end |