I use capybara to write feature specifications.
class UserController <ApplicationController
def index
redirect_to new_user_path
end
def new
# something
end
end
If there is a controller called
feature "sample features",:type=>:feature do
scenario "Transition to new user creation screen" do
visit users_path
expect(current_path).to eq new_user_path
end
end
As mentioned above, I would like to verify that you have been redirected to the redirect destination page after some event. Is there any way?
ruby-on-rails rspec
I think you can write an example like the following.
If you click on visit as you like, you can change it to a method that moves you.
feature "sample features",:type=>:feature do
scenario "Transition to new user creation screen" do
visit users_path
expect {visit new_user_path}.to change {
current_path
}.from(users_path).to(users_path)
end
end
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
709 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.