ruby on rails - capybara and RSpec: ajax response not working -


i'm working on writing test cases using (rspec , capybara).

capybara (2.7.1) ,  rspec (3.4.0) rspec-core (3.4.4) rspec-expectations (3.4.0) rspec-mocks (3.4.1) rspec-rails (3.4.2) rspec-support (3.4.1) 

there many answers available no luck!!!. these result found: 1, 2, , 3

capybara.rb

capybara.asset_host = 'http://localhost:3000' capybara.default_max_wait_time = 5 

session_helpers.rb

module features   module sessionhelpers     def sign_up_with(email, password, confirmation)       visit new_user_registration_path       fill_in 'email', with: email       fill_in 'password', with: password       fill_in 'password confirmation', :with => confirmation       click_button 'sign up'     end      def signin(email, password)       visit root_url       find(:xpath, "//a[@class='login_box_btn']").click       fill_in 'login_user_email',    with: email       fill_in 'login_user_password', with: password       click_button "login"     end   end end 

features/users/sign_in_spec.rb

feature 'sign-in , sign-out', :devise  scenario 'user cannot sign in if not registered'     signin('test@example.com', 'please123')     expect(page.find(:xpath, "//div[@id='login_message']")).to  have_content("email not found. please provide valid email.") end 

on expecting

find(:xpath, "//div[@id='login_message']") => "" 

but should not empty.

as i'm following railsapps/rails-devise things done configuration according repo.

please comment in case if need more info on this.

try add js: true scenario, like:

 scenario 'user cannot sign in if not registered', js: true 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -