File: cucumber_steps.rb

package info (click to toggle)
cucumber 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,584 kB
  • sloc: ruby: 11,799; python: 28; makefile: 8; tcl: 3
file content (23 lines) | stat: -rw-r--r-- 660 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
When /^I run cucumber "(.+)"$/ do |cmd|
  run_simple(unescape("cucumber #{cmd}"), false)
end

Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
  # Need to store it in a variable. With JRuby we can only do this once it seems :-/
  stdout = all_stdout
  
  # JRuby has weird traces sometimes (?)
  stdout = stdout.gsub(/ `\(root\)':in/, '') 

  actual = JSON.parse(stdout)
  expected = JSON.parse(json)
  
  actual.should == expected
  assert_success(pass_fail == 'pass')
end

Given /^a directory without standard Cucumber project directory structure$/ do
  in_current_dir do
    FileUtils.rm_rf 'features' if File.directory?('features')
  end
end