spec-converter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.txt CHANGED
@@ -7,7 +7,7 @@
7
7
  This will change all files in place!! Make sure you are properly backed up and/or committed to SVN before running.
8
8
 
9
9
  == INSTALL
10
- sudo gem install spec_converter
10
+ sudo gem install spec-converter
11
11
 
12
12
  == USAGE
13
13
  Assuming your project is at ~/work/project/:
@@ -25,7 +25,7 @@ Assuming your project is at ~/work/project/:
25
25
 
26
26
  (The MIT License)
27
27
 
28
- Copyright (c) 2007 Relevance
28
+ Copyright (c) 2007-08 Relevance
29
29
 
30
30
  Permission is hereby granted, free of charge, to any person obtaining
31
31
  a copy of this software and associated documentation files (the
@@ -1,7 +1,7 @@
1
1
  # Simple converter to go to test/spec style
2
2
  # This will change all files in place, so make sure you are properly backed up and/or committed to SVN!
3
3
  class SpecConverter
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
 
6
6
  def self.start
7
7
  spec_converter = SpecConverter.new
@@ -35,10 +35,15 @@ class SpecConverter
35
35
  convert_dust_style(line)
36
36
  convert_test_unit_class_name(line)
37
37
  convert_test_unit_methods(line)
38
+ convert_def_setup(line)
38
39
  line
39
40
  end
40
41
 
41
42
  private
43
+
44
+ def convert_def_setup(line)
45
+ line.gsub!(/(^\s*)def setup(\s*)$/, '\1before do\2')
46
+ end
42
47
 
43
48
  def convert_rspec_old_style_names(line)
44
49
  line.gsub!(/(^\s*)context(\s.*do)/, '\1describe\2')
@@ -5,7 +5,7 @@ require 'tempfile'
5
5
  require File.dirname(__FILE__) + '/../lib/spec_converter'
6
6
 
7
7
  describe "converting from test/spec old style to new style names" do
8
- setup do
8
+ before do
9
9
  @converter = SpecConverter.new
10
10
  end
11
11
 
@@ -53,7 +53,7 @@ describe "translate file overwrites old file with translated stuff" do
53
53
  end
54
54
 
55
55
  describe "converting dust style to test/spec style" do
56
- setup do
56
+ before do
57
57
  @converter = SpecConverter.new
58
58
  end
59
59
 
@@ -68,7 +68,7 @@ describe "converting dust style to test/spec style" do
68
68
  end
69
69
 
70
70
  describe "converting ActionController::IntegrationTest style to describe blocks" do
71
- setup do
71
+ before do
72
72
  @converter = SpecConverter.new
73
73
  end
74
74
 
@@ -78,7 +78,7 @@ describe "converting ActionController::IntegrationTest style to describe blocks"
78
78
  end
79
79
 
80
80
  describe "converting Test::Unit style to describe blocks" do
81
- setup do
81
+ before do
82
82
  @converter = SpecConverter.new
83
83
  end
84
84
 
@@ -102,9 +102,21 @@ describe "converting Test::Unit style to describe blocks" do
102
102
  end
103
103
 
104
104
  describe "converting Test::Unit methods to it blocks" do
105
- setup do
105
+ before do
106
106
  @converter = SpecConverter.new
107
107
  end
108
+
109
+ it "replaces def setup with before do" do
110
+ @converter.convert_line(%[def setup\n]).should == %[before do\n]
111
+ end
112
+
113
+ it "ignores method definitions that only start with setup" do
114
+ @converter.convert_line(%[def setup_my_object]).should == %[def setup_my_object]
115
+ end
116
+
117
+ it "replaces class def test_something? with it something? do" do
118
+ @converter.convert_line(%[def test_something?]).should == %[it "something?" do]
119
+ end
108
120
 
109
121
  it "replaces class def test_something? with it something? do" do
110
122
  @converter.convert_line(%[def test_something?]).should == %[it "something?" do]
@@ -129,7 +141,7 @@ describe "converting Test::Unit methods to it blocks" do
129
141
  end
130
142
 
131
143
  describe "converting things in batch" do
132
- setup do
144
+ before do
133
145
  @converter = SpecConverter.new
134
146
  end
135
147
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spec-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Relevance
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-04 00:00:00 -05:00
12
+ date: 2008-01-10 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency