Sha256: aa6ccfe6679d7a4140b23799eeeba5c6e0c11043f82f40d55c09b06e1167f213

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

require 'tempfile'
require 'open3'

def spec_helper_path
  File.expand_path '../../../spec/spec_helper.rb', __FILE__
end

Given /^a simple rails application$/ do
  @prepend = "require #{spec_helper_path.inspect}\n\n"
end

Given /^the following spec:$/ do |string|
  f = Tempfile.new 'cucumber'
  f.write @prepend if @prepend
  # a hack to force controller type even though we're a tempfile
  string.sub!(/(describe [a-zA-Z]+Controller) do$/, '\1, :type => :controller do')
  f.write string
  @spec_path = f.path
  f.close
end

When /^I run rspec$/ do
  @spec_output = nil
  args = %w(bundle exec rspec -f d) + [@spec_path]
  stdin, stdout, stderr = Open3.popen3 *args
  @spec_output = stdout.read
  $stderr.write stderr.read
end

Then /^the output should contain:$/ do |string|
  @spec_output.should include(string)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-rails-controller-0.1.2 features/steps/macro_steps.rb