Skip to content

Instantly share code, notes, and snippets.

@tbaba
Created April 11, 2014 03:34
Show Gist options
  • Save tbaba/10439613 to your computer and use it in GitHub Desktop.
Save tbaba/10439613 to your computer and use it in GitHub Desktop.
テキストエリアの中身のテストをしたいときあるじゃん? ref: http://qiita.com/tbaba/items/75038d857221668a8e3c
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
= 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
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
= 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