【发布时间】:2015-01-20 06:34:12
【问题描述】:
require "spec_helper"
require "rails_helper"
include Capybara::RSpecMatchers
include Capybara::DSL
Capybara.javascript_driver = :webkit
feature "Course", :type => :feature do
scenario "Get index and search for course types", js: true do
visit "/courses"
within("//body") do
find(:xpath, "//input[@id='course_type_id_1']").click
find(:xpath, "//div[@class='course-right-sec']")
expect(page).to have_content('65,171 courses')
expect(page).to have_content('Fundamentals of Design')
end
end
end
上面的代码我面临的问题是,当我在一个 inside 块中找到一个特定的 div 时,该 div 的 id 是否正确,它是否通过了测试。
【问题讨论】:
-
你解决了吗?因为我也遇到了在块内查找的问题......
标签: ruby-on-rails rspec capybara integration-testing