【发布时间】:2019-02-05 15:35:52
【问题描述】:
我有一个用 RSpec 和 Capybara 编写的测试不应该通过,但是它是:
it 'should have the given text' do
visit root_path
expect(page).to have_text("This is not here")
end
然后我将其包含在测试中以查找问题:
puts page.text
它返回的文本比页面上的多得多,其中包括:
Extracted source (around line #12):
10 11 12 13
})
visit root_path
expect(page).to have_text("This is not here")
看起来我在测试中输入的任何内容都会在调用has_text? 时出现。为什么它包含所有不在页面上的文本?
【问题讨论】:
标签: ruby-on-rails testing rspec capybara