Sha256: bc5f598f41046f25df820dcc6411765ca16b653f9c33019402b629d630883c90
Contents?: true
Size: 1.15 KB
Versions: 12
Compression:
Stored size: 1.15 KB
Contents
require 'yaml' require 'open3' Given(/^I have set up my `environments\.yml`$/) do step 'the "tmp/rspec/spec" directory exists' File.open('tmp/rspec/environments.yml', 'w') { |io| io.write(YAML.dump({ 'default' => {} })) } end Given(/^the following RSpec support file:$/) do |content| File.open('tmp/rspec/spec/spec_helper.rb', 'w') { |io| io.write(content) } end Given(/^the following RSpec examples:$/) do |content| content = "require 'spec_helper'\n#{content}" File.open('tmp/rspec/spec/examples_spec.rb', 'w') { |io| io.write(content) } end Given(/^$the following "(.+)" file for use with RSpec$/) do |path, content| File.open(File.join('tmp/rspec', path), 'w') { |io| io.write(content) } end When(/^I run `rspec` against my examples$/) do env = { 'MEDIAWIKI_ENVIRONMENT' => 'default' } cmd = "'#{Gem.bin_path('bundler', 'bundle')}' exec rspec" @rspec_output, @rspec_status = Open3.capture2e(env, cmd, chdir: 'tmp/rspec') end Then(/^I should see (\d+) passing examples?$/) do |n| expect(@rspec_status).to be_success, "Examples did not pass. Output:\n---\n#{@rspec_output}---\n" expect(@rspec_output).to match(/^#{n} examples?, 0 failures/) end
Version data entries
12 entries across 12 versions & 1 rubygems