forked from dchelimsky/rspec
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
begin migrating stories to cucumber features
- Loading branch information
1 parent
07a299e
commit a8ae31d
Showing
4 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/example_groups/autogenerated_docstrings → ...e_groups/autogenerated_docstrings.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Given /^the file (.*)$/ do |relative_path| | ||
@path = File.expand_path(File.join(File.dirname(__FILE__), "..", "resources", relative_path)) | ||
unless File.exist?(@path) | ||
raise "could not find file at #{@path}" | ||
end | ||
end | ||
|
||
When /^I run it with the (.*)$/ do |interpreter| | ||
stderr_file = Tempfile.new('rspec') | ||
stderr_file.close | ||
@stdout = case(interpreter) | ||
when /^ruby interpreter/ | ||
args = interpreter.gsub('ruby interpreter','') | ||
ruby("#{@path}#{args}", stderr_file.path) | ||
when /^spec script/ | ||
args = interpreter.gsub('spec script','') | ||
spec("#{@path}#{args}", stderr_file.path) | ||
when 'CommandLine object' then cmdline(@path, stderr_file.path) | ||
else raise "Unknown interpreter: #{interpreter}" | ||
end | ||
@stderr = IO.read(stderr_file.path) | ||
@exit_code = $?.to_i | ||
end | ||
|
||
Then /^the (.*) should match (.*)$/ do |stream, string_or_regex| | ||
written = case(stream) | ||
when 'stdout' then @stdout | ||
when 'stderr' then @stderr | ||
else raise "Unknown stream: #{stream}" | ||
end | ||
written.should smart_match(string_or_regex) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'tempfile' | ||
require File.dirname(__FILE__) + '/../../spec/ruby_forker' | ||
require File.dirname(__FILE__) + '/../../stories/resources/matchers/smart_match' | ||
|
||
require 'spec/expectations' | ||
require 'spec/matchers' | ||
|
||
module RspecWorld | ||
include Spec::Expectations | ||
include Spec::Matchers | ||
include RubyForker | ||
|
||
def spec(args, stderr) | ||
ruby("#{File.dirname(__FILE__) + '/../../bin/spec'} #{args}", stderr) | ||
end | ||
|
||
def cmdline(args, stderr) | ||
ruby("#{File.dirname(__FILE__) + '/../../resources/helpers/cmdline.rb'} #{args}", stderr) | ||
end | ||
end | ||
|
||
World do |world| | ||
world.extend(RspecWorld) | ||
world | ||
end |