gpt4 book ai didi

ruby-on-rails - rspec 如何使用 capybara 查询 html 正文电子邮件

转载 作者:行者123 更新时间:2023-12-04 06:09:08 25 4
gpt4 key购买 nike

也许这是新手问题,但我被卡住了。我尝试用 capybara 查询 html 电子邮件,但没有成功。这是规范

# encoding: utf-8
require "spec_helper"
require "resque"
require "resque_spec"

describe 'MailerUtils in action' do
include MailerMacros

let(:service_provider_email) { FactoryGirl.create(:service_provider_email) }
let(:service_provider) { service_provider_email.service_provider }
let(:service_provider_email_list) { service_provider_email.service_provider_email_list }

before :all do
Resque.inline = true
end

describe 'send one marketing email and unsubscribe' do
before :each do
reset_email
PromotionActions.perform :too_low_profile_score, service_provider.id
end

it "should have unsubscribe link" do
last_email.body.should have_content("отписаться от рассылки")
end

it "should have correct city in link" do
last_email.body.find(:xpath, "//a[@id=\"unsubscribe_link\"][@href=\"http://#{service_provider.city.name}.#{service_provider.country.domain}/#{service_provider.code}?uncheck=marketing]")
end
end
end

最后一个例子失败了。如何从电子邮件中查询 html?

最佳答案

Capybara.string(last_email.body).find(...)

关于ruby-on-rails - rspec 如何使用 capybara 查询 html 正文电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11155332/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com