-
-
Save kidach1/7636131 to your computer and use it in GitHub Desktop.
Railsにおけるリンクの記述方法とそのテスト ref: http://qiita.com/kidachi_/items/d704e7eb63513c3831ae
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
<%= link_to "About", about_path %> |
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
<a href="/static_pages/about">About</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
root_path => '/' | |
root_url => 'http://localhost:3000/' |
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
visit foo_path | |
click_link "var" |
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
about_path -> '/about' | |
about_url -> 'http://localhost:3000/about' |
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
root 'controller_name#action_name' |
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
SampleApp::Application.routes.draw do | |
root 'static_pages#home' | |
match '/help', to: 'static_pages#help', via: 'get' | |
match '/about', to: 'static_pages#about', via: 'get' | |
match '/contact', to: 'static_pages#contact', via: 'get' | |
~ | |
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
require 'spec_helper' | |
describe "Static pages" do | |
~ | |
it "should have the right links on the layout" do | |
visit root_path | |
click_link "About" | |
expect(page).to have_title(full_title('About Us')) | |
click_link "Help" | |
expect(page).to have_title(full_title('Help')) | |
click_link "Contact" | |
expect(page).to have_title(full_title('Contact')) | |
click_link "Home" | |
expect(page).to have_title(full_title('')) | |
click_link "Sign up now!" | |
expect(page).to have_title(full_title('Sign up')) | |
click_link "sample app" | |
expect(page).to have_title(full_title('')) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment