简体   繁体   中英

Ruby on Rails features

I am trying to write a feature for clicking a button my query runs like Select * from histories where name %LIKE% (data) and show it is page.

I have written so far:

Scenario: Specific Records

When I fill in "search" with "Akshay"

And I press "Search"

Then I should see records of Akshay

Can somebody help me to write the web definitions for the the third line "Then Then I should see records of Akshay"

Thank you

In the step you can write like below

Then /^I should see records of following people$/ do |data|
 records = page.all("#records")
 data.hashes.each do |row|
  record = records.find do |record|
    record.text =~ Regexp.new(Regexp.escape(row["name"]))
  end
  raise "record not found." if record.blank?
end

Similary then in the scenario u can write

Then I should see records of following people
|name |
|Aksay|

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM