Created
April 11, 2014 03:34
-
-
Save tbaba/10439613 to your computer and use it in GitHub Desktop.
テキストエリアの中身のテストをしたいときあるじゃん? ref: http://qiita.com/tbaba/items/75038d857221668a8e3c
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' | |
feature 'Course' do | |
describe 'new course' do | |
scenario '新しいコースを作成する' do | |
visit new_course_path | |
fill_in 'course_title', with: 'なんかタイトル' | |
# NOTE 大事なのココな | |
textarea = find('#course_body') | |
expect(textarea.value).to match /何かデフォルトの文章みたいなアレ/ | |
fill_in 'course_body', with: 'なんか違う文章' | |
click_button 'Save' | |
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
= form_for @course do |f| | |
.field | |
= f.label :title | |
= f.text_field :title | |
.field | |
= f.label :body | |
= f.text_area :body, value: '何かデフォルトの文章みたいなアレ' | |
.submit-button | |
= f.submit |
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
feature 'Course' do | |
describe 'new course' do | |
scenario '新しいコースを作成する' do | |
visit new_course_path | |
fill_in 'course_title', with: 'なんかタイトル' | |
# NOTE 大事なのココな | |
textarea = find('#course_body') | |
expect(textarea.value).to match /何かデフォルトの文章みたいなアレ/ | |
fill_in 'course_body', with: 'なんか違う文章' | |
click_button 'Save' | |
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
= form_for @course do |f| | |
.field | |
= f.label :title | |
= f.text_field :title | |
.field | |
= f.label :body | |
= f.text_area :body, value: '何かデフォルトの文章みたいなアレ' | |
.submit-button | |
= f.submit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment