Sha256: 2956adcad3a4700f01e40c611cf7ebb9845c416828da15eb3687ab71c701ab77

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

#!/usr/bin/env ruby
Dir.chdir File.join(File.dirname(__FILE__), '..')
data = IO.read('spec/active_record/blueprints_spec.rb')

data.gsub!("require File.dirname(__FILE__) + '/spec_helper'", "require File.dirname(__FILE__) + '/test_helper'")
data.gsub!("describe Blueprints do", 'class BlueprintsTest < ActiveSupport::TestCase')

# lambda {
#   hornsby_clear :undo => :just_orange
# }.should raise_error(ArgumentError)
data.gsub!(/(\s+)lambda \{\n(.*)\n(\s+)\}.should raise_error\((.*)\)/, "\\1assert_raise(\\4) do\n\\2\n\\3end")
# .should_not => assert(!())
data.gsub!(/^(\s+)(.*)\.should_not(.*)/, '\1assert(!(\2\3))')
# .should => assert()
data.gsub!(/^(\s+)(.*)\.should(.*)/, '\1assert(\2\3)')
# be_nil => .nil?
data.gsub!(/ be_([^\(\)]*)/, '.\1?')
# have(2).items => .size == 2
data.gsub!(/ have\((\d+)\)\.items/, '.size == \1')

data.gsub!(/^(\s+)describe/, '\1context')
data.gsub!(/^(\s+)it (["'])(should )?/, '\1should \2')
data.gsub!(/^(\s+)before.*do/, '\1setup do')
data.gsub!(/^(\s+)after.*do/, '\1teardown do')

File.open('test/blueprints_test.rb', 'w') {|f| f.write(data)}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blueprints-0.5.0 script/rspec_to_test
blueprints-0.4.2 script/rspec_to_test
blueprints-0.4.1 script/rspec_to_test
blueprints-0.4.0 script/rspec_to_test
blueprints-0.3.4 script/rspec_to_test