Given /^fund as "([^"]*)",date as "([^\"]*)",ticker_search as "([^\"]*)"$/ do |fund,date,ticker|
visit '/nav_pricings'
select "Central Asian Prosperity Fund", :from => 'fund'
fill_in 'date', :with => date
fill_in 'ticker_search', :with => ticker
click_on 'Show Pricing'
end
我试图从下拉中选择基金(中亚繁荣基金),但如果我运行上述测试案例,资金表变为空,所以它显示如下错误
无法选择选项,在选择框'基金'(Capybara :: ElementNotFound)中没有文字'中亚繁荣基金'的选项
(eval):2:在send'
(eval):2:in
选择'
答案 0 :(得分:0)
尝试不传递String
实例'fund'
,但传递fund
变量本身:
select "Central Asian Prosperity Fund", :from => fund
答案 1 :(得分:0)
如果您的下拉列表中没有填充所需的数据,那么您需要使用FactoryGirl rails来填充需要使用数据的测试数据库
https://github.com/thoughtbot/factory_girl_rails
# This will guess the User class
FactoryGirl.define do
factory :fund do
fund_name "Central Asian Prosperity Fund"
end
end