http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table
=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') |
include Rails.application.routes.url_helpers | |
begin | |
namespace :admin do | |
task :create => :environment do | |
puts "You will be prompted to enter an email address and password for the new admin" | |
puts "Enter an email address:" | |
email = STDIN.gets | |
puts "Enter a password:" | |
password = STDIN.gets |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |
http://guides.rubyonrails.org/migrations.html