Sha256: 4e7ce7c47f3a1f415f49fa2d7a14894308813ede330d2b681faa783b810e8df7

Contents?: true

Size: 1.74 KB

Versions: 2

Compression:

Stored size: 1.74 KB

Contents

Given /^an empty directory named "([^"]*)"$/ do |dir_name|
  FileUtils.rm_rf File.expand_path("../../../tmp/lurker_app/#{dir_name}", __FILE__)
  create_dir(dir_name)
end

When /^I go to "([^"]*)"$/ do |url|
  visit(url)
end

When /^I click on "([^"]*)"$/ do |text|
  find(:xpath, "//*[contains(text(),'#{text}')]").click
end

When(/^I fill in the submit form field "([^"]*)" with "([^"]*)"$/) do |field, name|
  fill_in("user[#{field}]", with: name)
end

When(/^I fill in the submit form url-field "([^"]*)" with "([^"]*)"$/) do |field, name|
  fill_in("_url_params[#{field}]", with: name)
end

When(/^I submit lurk form$/) do
  find(:xpath, "//*[@type='submit']").click
end

When(/^I submit it$/) do
  find(:xpath, "//*[@type='submit']").click
end

Then /^the example(s)? should( all)? pass$/ do |_, _|
  step %q{the output should contain "0 failures"}
  step %q{the exit status should be 0}
end

Then /^the file "([^"]*)" should contain JSON-Schema:$/ do |file, schema|
  prep_for_fs_check do
    content = IO.read(file)
    # TODO: match schema via schema
  end
end

Then /^I should see "([^"]*)"$/ do |text|
  expect(find(:xpath, "//*[contains(text(),'#{text}')]")).to be
end

Then /^I should see "([^"]*)" within "([^"]*)"$/ do |text, selector|
  expect(find(:xpath, "//#{selector}[contains(text(),'#{text}')]")).to be
end

Then /^the output should contain (failures|these lines):$/ do |_, lines|
  out = all_output.dup
  lines.split(/\n/).map(&:strip).each do |line|
    next if line.blank?
    expect(out).to match /#{Regexp.escape(line)}/
    out.gsub!(/.*?#{Regexp.escape(line)}/m, '')
  end
end

Then(/^I should see JSON response with "([^"]*)"$/) do |name|
  within(find(:xpath, "//*[@id='show-api-response-div']")) do
    expect(page).to have_content name
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lurker-0.5.1 features/step_definitions/additional_cli_steps.rb
lurker-0.5.0 features/step_definitions/additional_cli_steps.rb