gpt4 book ai didi

ruby-on-rails - cucumber :无法将 nil 转换为字符串 TypeError

转载 作者:行者123 更新时间:2023-12-02 03:55:00 26 4
gpt4 key购买 nike

filter_movie_list.feature

当我检查以下评级时:PG、R

电影步骤.rb

When /^I check the following ratings: (.*)/ do |rating_list|
within(:id => 'ratings_form') do
rating_list.split(', ').each do |rating|
check("ratings_#{rating}")
end
end
end

index.html.haml

= form_tag movies_path, :method => :get, :id => 'ratings_form' do
= hidden_field_tag "title_sort", true if @title_header
= hidden_field_tag ":release_date_sort", true if @date_header
Include:
- @all_ratings.each do |rating|
= rating
= check_box_tag "ratings[#{rating}]", 1, @selected_ratings.include?(rating), :id => "ratings_#{rating}"
= submit_tag 'Refresh', :id => 'ratings_submit'

我收到这个错误:

When I check the following ratings: PG, R          #step_definitions/movie_steps.rb:21
can't convert nil into String (TypeError)
(eval):2:in `find'
./step_definitions/movie_steps.rb:22:in `/^I check the following ratings: (.*)/'
filter_movie_list.feature:26:in `When I check the following ratings: PG, R'

做什么?

编辑:很抱歉 n00bishness(格式错误)

最佳答案

尝试将您的 within 更改为:within('#ratings_form') 看看是否有任何改变...

关于ruby-on-rails - cucumber :无法将 nil 转换为字符串 TypeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13074855/

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