rspecify 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
data/lib/rspecify/runner.rb
CHANGED
@@ -7,7 +7,10 @@ module RSpecify
|
|
7
7
|
def cat(path)
|
8
8
|
sexp = RubyParser.new.parse(File.read(path))
|
9
9
|
sexp = RSpecify::Transformer.new.transform(sexp)
|
10
|
-
|
10
|
+
RubyScribe::Emitter.new.tap do |emitter|
|
11
|
+
emitter.methods_without_parenthesis += ["it", "describe", "context", "should", "should_not"]
|
12
|
+
puts emitter.emit(sexp)
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
protected
|
@@ -14,15 +14,19 @@ module RSpecify
|
|
14
14
|
case
|
15
15
|
when assert_equals_call?(e)
|
16
16
|
transform_assert_equals_call(e)
|
17
|
+
when assert_not_equals_call?(e)
|
18
|
+
transform_assert_not_equals_call(e)
|
19
|
+
when assert_not_nil_call?(e)
|
20
|
+
transform_assert_not_nil_call(e)
|
17
21
|
else
|
18
22
|
e
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
26
|
+
# assert_equals:
|
22
27
|
def assert_equals_call?(e)
|
23
28
|
e.kind == :call && e.body[0].nil? && e.body[1] == :assert_equals
|
24
29
|
end
|
25
|
-
|
26
30
|
def transform_assert_equals_call(e)
|
27
31
|
method_arguments = e.body[2].body
|
28
32
|
|
@@ -32,6 +36,33 @@ module RSpecify
|
|
32
36
|
s(:arglist, method_arguments[1])
|
33
37
|
)
|
34
38
|
end
|
39
|
+
|
40
|
+
# assert_not_equals:
|
41
|
+
def assert_not_equals_call?(e)
|
42
|
+
e.kind == :call && e.body[0].nil? && e.body[1] == :assert_not_equals
|
43
|
+
end
|
44
|
+
def transform_assert_not_equals_call(e)
|
45
|
+
method_arguments = e.body[2].body
|
46
|
+
|
47
|
+
s(:call,
|
48
|
+
s(:call, method_arguments[0], :should_not, s(:arglist)),
|
49
|
+
:==,
|
50
|
+
s(:arglist, method_arguments[1])
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
# assert_not_nil:
|
55
|
+
def assert_not_nil_call?(e)
|
56
|
+
e.kind == :call && e.body[0].nil? && e.body[1] == :assert_not_nil
|
57
|
+
end
|
58
|
+
def transform_assert_not_nil_call(e)
|
59
|
+
method_arguments = e.body[2].body
|
60
|
+
|
61
|
+
s(:call, method_arguments[0], :should_not,
|
62
|
+
s(:arglist, s(:call, nil, :be_nil, s(:arglist)))
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
35
66
|
end
|
36
67
|
|
37
68
|
end
|
data/lib/rspecify/version.rb
CHANGED
@@ -18,4 +18,14 @@ describe RSpecify::Transformers::TestUnitAssertions.new do
|
|
18
18
|
it { should transform_to("should == ", %{@organization.people.first.should == Person.find_by_name_and_organization("Ben, Hughes", "RailsGarden")}) }
|
19
19
|
end
|
20
20
|
|
21
|
+
describe "short assert not equals" do
|
22
|
+
subject { %{assert_not_equals @one, "One"} }
|
23
|
+
it { should transform_to("should_not ==", %{@one.should_not == "One"}) }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "short assert not nil" do
|
27
|
+
subject { %{assert_not_nil @one} }
|
28
|
+
it { should transform_to("should_not be_nil", %{@one.should_not(be_nil)}) }
|
29
|
+
end
|
30
|
+
|
21
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspecify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-11 00:00:00.
|
12
|
+
date: 2011-10-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70216158782120 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.13'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70216158782120
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70216158781140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 3.0.10
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70216158781140
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: i18n
|
38
|
-
requirement: &
|
38
|
+
requirement: &70216158778560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.6.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70216158778560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: ruby_parser
|
49
|
-
requirement: &
|
49
|
+
requirement: &70216158777860 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70216158777860
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: ruby_scribe
|
60
|
-
requirement: &
|
60
|
+
requirement: &70216158776420 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.1.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70216158776420
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ruby_transform
|
71
|
-
requirement: &
|
71
|
+
requirement: &70216158764980 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.1.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70216158764980
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &70216158764140 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '2.0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70216158764140
|
91
91
|
description: Provides some automation to attempt to convert your Ruby Test::Unit tests
|
92
92
|
into RSpec.
|
93
93
|
email: ben@railsgarden.com
|