cd my_project
git init .
git add . # add everything
git commit -m 'Initial commit'
... make some changes ...
# Solution from http://www.jamiepenney.co.nz/2011/09/23/testing-content_for-in-rails-3-x-helpers-with-rspec/ | |
describe ApplicationHelper do | |
describe "title" do | |
it "should return an h2 tag with the given title" do | |
helper.title("Lorem Ipsum") | |
helper.content_for(:page_title).should eql "<h2>Lorem Ipsum</h2>" | |
end | |
it "should return the supplied block if a block was given" do |
# ... | |
gem 'carrierwave' | |
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
# Creates a new Rails 4 application configured with | |
# Slim, PostgreSQL, TestUnit (minitest), FactoryGirl, SimpleCov, Capybara, Capistrano ... | |
# | |
# Based on template generated at http://railswizard.org/ | |
# USAGE | |
# $ rails new APP_NAME -JTm rails_app_template.rb | |
# Will be specified by default Gemfile | |
# gem 'rails', '4.2.0' |
adb shell pm list packages |
Factory.define :application do |factory| | |
factory.attachment :sample, "public/samples/sample.doc", "application/msword" | |
end |
# app/helpers/application_helper.rb | |
def sanitized_object_name(object_name) | |
object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") | |
end | |
def sanitized_method_name(method_name) | |
method_name.sub(/\?$/, "") | |
end | |
def form_tag_id(object_name, method_name) |
Object.extend(String.prototype, { | |
/** | |
* Converts an underscore string into object attribute format for submission | |
* to a server (Based on Rails). | |
* | |
* To attributize the string client_firstName | |
* "client_firstName".attributize() | |
* => client[first_name] | |
* | |
* To attributize the string client_addresses__street |