1
Firefox에서 제목이없는 게시물을 제출하려고하면 오류가 발생하여이 게시물을 저장할 수 없습니다..왜 내 테스트가이 양식에서 작동하지 않습니까?
하지만 테스트를 실행할 때. 그것은 다른 이야기입니다.
내 게시물 모델의 모델은 validates_presence_of :title
입니다. 내 제출 버튼을 실제로 일부 JS와 앵커 링크이기 때문에, 내가 셀레늄 (:js => true
)를 사용하고, 그런데
require 'spec_helper'
describe 'Users' do
it 'registered users should not be able to post without a title', :js => true do
user = Factory(:user)
visit new_post_path
current_path.should eq(new_post_path)
fill_in 'post[markdown_description]', :with => 'Bar'
click_on 'Submit your post'
page.should have_content('error')
end
end
: 내 테스트는 것 같습니다. 기본적으로 링크를 클릭하면 JS가 양식을 제출하여 제출합니다.
RSpec에 반환 : 당신이 before_filters
이있는 경우
Running: spec/requests/users_spec.rb
F
Failures:
1) Users registered users should be able to post
Failure/Error: page.should have_content('error')
expected there to be content "error" in ""
# ./spec/requests/users_spec.rb:13:in `block (2 levels) in <top (required)>'
Finished in 7.9 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/requests/users_spec.rb:4 # Users registered users should be able to post