Created
March 21, 2012 03:13
-
-
Save ghsyeung/2143985 to your computer and use it in GitHub Desktop.
Starting a RoR project
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
require 'spec-helper' | |
describe UserController do | |
describe "Search user with name" do | |
it "should respond to search user route" | |
it "should call User model method to search user with same name" | |
it "should show view with the list of matching users" do | |
response.should render_template("matching_users") | |
it "should redirect to index page if not found" do | |
response.should redirect_to(:action => ) | |
end | |
end | |
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
# Cucumber | |
# step to load table | |
Given /the following movies exist/ do |movies_table| | |
movies_table.hashes.each do |movie| | |
Movie.create(:title => movie[:title].strip, :rating => movie[:rating].strip, :release_date => movie[:release_date].strip) | |
end | |
end | |
# adding path patterns | |
when /^the edit page for "(.*)"$/ | |
edit_movie_path(Movie.find_by_title($1)) |
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
# Generating the cucumber and rspec files | |
rails g cucumber:install capybara | |
rails g cucumber_rails_training_wheels:install | |
rails g rspec:install | |
# make necessary db changes | |
rails g migration Add[Column]To[Table] [column]:[type] | |
# prepare database | |
rake db:migrate | |
rake db:test:prepare | |
# check if done properly | |
rake spec | |
rake cucumber |
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
BlogApp::Application.routes.draw do | |
# now can use call_user_path and call_user_url | |
match 'users/:id/call' => 'users#call', :as => 'call_user' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment