Ruby on rails Omniauth实体模型在rails rspec中不起作用。谷歌登录按钮没有被点击
以下是互联网上关于谷歌登录Rails集成测试的教程。我来到这里。但它不起作用Ruby on rails Omniauth实体模型在rails rspec中不起作用。谷歌登录按钮没有被点击,ruby-on-rails,rspec,capybara,omniauth,Ruby On Rails,Rspec,Capybara,Omniauth,以下是互联网上关于谷歌登录Rails集成测试的教程。我来到这里。但它不起作用 # frozen_string_literal: true require "rails_helper" def stub_omniauth OmniAuth.config.test_mode = true OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({ provider: "google_oa
# frozen_string_literal: true
require "rails_helper"
def stub_omniauth
OmniAuth.config.test_mode = true
OmniAuth.config.mock_auth[:google_oauth2] = OmniAuth::AuthHash.new({
provider: "google_oauth2",
uid: "12345678910",
info: {
email: "limsammy1@gmail.com",
first_name: "Sam",
last_name: "Lim"
},
credentials: {
token: "abcdefg12345",
refresh_token: "abcdefg12345",
expires_at: DateTime.now,
}
})
end
RSpec.feature "user logs in" do
scenario "using google oauth2" do
visit login_path
stub_omniauth
Rails.application.env_config["omniauth.auth"] = OmniAuth.config.mock_auth[:google_oauth2]
expect(page).to have_css("a.google-login-button")
find("a.google-login-button").click
expect(page.current_path).to eq(dashboard_path)
end
end
我假设在运行测试后,我的页面内容会发生变化,但它们与以前相同