pretentious 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +6 -1
- data/example.rb +4 -1
- data/lib/pretentious.rb +5 -1
- data/lib/pretentious/generator.rb +30 -4
- data/lib/pretentious/minitest_generator.rb +6 -4
- data/lib/pretentious/rspec_generator.rb +6 -4
- data/lib/pretentious/version.rb +2 -2
- data/run_test.sh +1 -1
- data/spec/test_class1_spec.rb +25 -11
- data/spec/test_class3_spec.rb +6 -6
- data/spec/test_class4_spec.rb +2 -2
- data/spec/test_class_for_auto_stub_spec.rb +1 -1
- data/spec/test_class_for_mocks_spec.rb +4 -4
- data/test/test_test_class1.rb +26 -11
- data/test/test_test_class3.rb +6 -6
- data/test/test_test_class4.rb +2 -2
- data/test/test_test_class_for_mocks.rb +4 -4
- data/test_classes.rb +5 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb9f74b26ae3f015b82651f96310897cfeba69f
|
4
|
+
data.tar.gz: 19e78abb1da16f1963bf9a4e5a16d6f96f2450b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2022904496f859df817cf11355e7601a736d4d019cb56341e4c9d3273544dc0d442dc3b25badabd46d935157620376432856a092ed9fb0238e2d5fb8479846bd
|
7
|
+
data.tar.gz: e02a0108fa7d9ae7c23c920d98d5f5da32adcf2a3ebce679804c3900496b0aeb701e97070baf9522cea3a8706e78c5035e04b6887df433c7aa522237c28480a5
|
data/README.md
CHANGED
@@ -274,7 +274,7 @@ Note that you must include the setup code in a place that you know runs before t
|
|
274
274
|
example, if you want to test a class that is used inside a controller in rails, it is best to put it in an initializer.
|
275
275
|
It is also recommended to call Pretentious.install_watcher early on to be able to generate better fixtures.
|
276
276
|
|
277
|
-
You can pass a block for manually handling for example
|
277
|
+
You can pass a block for manually handling the output, for example
|
278
278
|
|
279
279
|
```ruby
|
280
280
|
# initializers/pretentious.rb
|
data/Rakefile
CHANGED
data/example.rb
CHANGED
@@ -54,6 +54,9 @@ end
|
|
54
54
|
end
|
55
55
|
|
56
56
|
test_class_one.just_returns_true
|
57
|
+
|
58
|
+
test_class_object_return = TestClass1.new("Hello")
|
59
|
+
test_class_object_return.return_self(another_object)
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
@@ -89,4 +92,4 @@ Pretentious.minitest_for(Meme) do
|
|
89
92
|
meme = Meme.new
|
90
93
|
meme.i_can_has_cheezburger?
|
91
94
|
meme.will_it_blend?
|
92
|
-
end
|
95
|
+
end
|
data/lib/pretentious.rb
CHANGED
@@ -91,6 +91,10 @@ module Pretentious
|
|
91
91
|
Pretentious::Deconstructor.pick_name(let_variables, value.target_proc.object_id, declared_names)
|
92
92
|
elsif (value == nil)
|
93
93
|
"nil"
|
94
|
+
elsif Pretentious::Deconstructor.is_primitive?(value)
|
95
|
+
"#{value.to_s}"
|
96
|
+
elsif let_variables && let_variables[value.object_id]
|
97
|
+
Pretentious::Deconstructor.pick_name(let_variables, value.object_id, declared_names)
|
94
98
|
else
|
95
99
|
"#{value.to_s}"
|
96
100
|
end
|
@@ -106,4 +110,4 @@ module Pretentious
|
|
106
110
|
def self.on(target_class)
|
107
111
|
Pretentious::Trigger.new(target_class)
|
108
112
|
end
|
109
|
-
end
|
113
|
+
end
|
@@ -206,7 +206,21 @@ module Pretentious
|
|
206
206
|
|
207
207
|
def _call_method(target, method_sym, *arguments, &block)
|
208
208
|
|
209
|
-
klass =
|
209
|
+
klass = nil
|
210
|
+
begin
|
211
|
+
klass = _get_standin_class
|
212
|
+
rescue NameError=>e
|
213
|
+
result = nil
|
214
|
+
target.instance_exec do
|
215
|
+
result = if (@_instance.methods.include? method_sym)
|
216
|
+
@_instance.send(method_sym, *arguments, &block)
|
217
|
+
else
|
218
|
+
@_instance.send(:method_missing, method_sym, *arguments, &block)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
return result
|
222
|
+
end
|
223
|
+
|
210
224
|
caller_context = binding.of_caller(2)
|
211
225
|
|
212
226
|
is_stub = _is_stub?
|
@@ -413,7 +427,7 @@ module Pretentious
|
|
413
427
|
params = if (self.respond_to? :test_class )
|
414
428
|
test_class.instance_method(:initialize).parameters
|
415
429
|
else
|
416
|
-
|
430
|
+
self.class.instance_method(:initialize).parameters
|
417
431
|
end
|
418
432
|
@_init_arguments[:params_types] = params
|
419
433
|
|
@@ -460,7 +474,19 @@ module Pretentious
|
|
460
474
|
|
461
475
|
def new(*args, &block)
|
462
476
|
instance = _ddt_old_new(*args, &block)
|
463
|
-
|
477
|
+
|
478
|
+
#rescues for handling native objects that don't have standard methoods
|
479
|
+
begin
|
480
|
+
if (instance.respond_to?(:_set_init_arguments))
|
481
|
+
instance._set_init_arguments(*args, &block)
|
482
|
+
end
|
483
|
+
rescue NoMethodError=>e
|
484
|
+
begin
|
485
|
+
instance._set_init_arguments(*args, &block)
|
486
|
+
rescue NoMethodError=>e2
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
464
490
|
instance
|
465
491
|
end
|
466
492
|
|
@@ -485,4 +511,4 @@ module Pretentious
|
|
485
511
|
|
486
512
|
end
|
487
513
|
|
488
|
-
end
|
514
|
+
end
|
@@ -99,9 +99,9 @@ class Pretentious::MinitestGenerator < Pretentious::GeneratorBase
|
|
99
99
|
end
|
100
100
|
|
101
101
|
if (result.kind_of? Exception)
|
102
|
-
str << pick_matcher(statement, result)
|
102
|
+
str << pick_matcher(statement, result, let_variables, declarations)
|
103
103
|
else
|
104
|
-
str << pick_matcher(statement, result)
|
104
|
+
str << pick_matcher(statement, result, let_variables, declarations)
|
105
105
|
end
|
106
106
|
str
|
107
107
|
end
|
@@ -238,7 +238,7 @@ class Pretentious::MinitestGenerator < Pretentious::GeneratorBase
|
|
238
238
|
# end
|
239
239
|
#end
|
240
240
|
|
241
|
-
def pick_matcher(statement, result)
|
241
|
+
def pick_matcher(statement, result, let_variables, declarations)
|
242
242
|
if result.is_a? TrueClass
|
243
243
|
"assert #{statement}"
|
244
244
|
elsif result.is_a? FalseClass
|
@@ -247,6 +247,8 @@ class Pretentious::MinitestGenerator < Pretentious::GeneratorBase
|
|
247
247
|
"assert_nil #{statement}"
|
248
248
|
elsif result.kind_of? Exception
|
249
249
|
"assert_raises(#{result.class.to_s}) { #{statement} }"
|
250
|
+
elsif let_variables && let_variables[result.object_id]
|
251
|
+
"assert_equal #{Pretentious::value_ize(result, let_variables, declarations)}, #{statement}"
|
250
252
|
else
|
251
253
|
"assert_equal #{Pretentious::value_ize(result, nil, nil)}, #{statement}"
|
252
254
|
end
|
@@ -320,4 +322,4 @@ class Pretentious::MinitestGenerator < Pretentious::GeneratorBase
|
|
320
322
|
puts "#{filename}"
|
321
323
|
end
|
322
324
|
end
|
323
|
-
end
|
325
|
+
end
|
@@ -97,9 +97,9 @@ class Pretentious::RspecGenerator < Pretentious::GeneratorBase
|
|
97
97
|
end
|
98
98
|
|
99
99
|
if (result.kind_of? Exception)
|
100
|
-
buffer("expect { #{statement} }.to #{pick_matcher(result)}",3)
|
100
|
+
buffer("expect { #{statement} }.to #{pick_matcher(result, let_variables, declarations)}",3)
|
101
101
|
else
|
102
|
-
buffer("expect( #{statement} ).to #{pick_matcher(result)}",3)
|
102
|
+
buffer("expect( #{statement} ).to #{pick_matcher(result, let_variables, declarations)}",3)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -215,7 +215,7 @@ class Pretentious::RspecGenerator < Pretentious::GeneratorBase
|
|
215
215
|
# end
|
216
216
|
#end
|
217
217
|
|
218
|
-
def pick_matcher(result)
|
218
|
+
def pick_matcher(result, let_variables, declared_names)
|
219
219
|
if result.is_a? TrueClass
|
220
220
|
'be true'
|
221
221
|
elsif result.is_a? FalseClass
|
@@ -224,6 +224,8 @@ class Pretentious::RspecGenerator < Pretentious::GeneratorBase
|
|
224
224
|
'be_nil'
|
225
225
|
elsif result.kind_of? Exception
|
226
226
|
'raise_error'
|
227
|
+
elsif let_variables && let_variables[result.object_id]
|
228
|
+
"eq(#{Pretentious::value_ize(result, let_variables, declared_names)})"
|
227
229
|
else
|
228
230
|
"eq(#{Pretentious::value_ize(result, nil, nil)})"
|
229
231
|
end
|
@@ -296,4 +298,4 @@ class Pretentious::RspecGenerator < Pretentious::GeneratorBase
|
|
296
298
|
puts "#{filename}"
|
297
299
|
end
|
298
300
|
end
|
299
|
-
end
|
301
|
+
end
|
data/lib/pretentious/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Pretentious
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.4"
|
3
|
+
end
|
data/run_test.sh
CHANGED
data/spec/test_class1_spec.rb
CHANGED
@@ -17,20 +17,20 @@ RSpec.describe TestClass1 do
|
|
17
17
|
|
18
18
|
context 'Scenario 2' do
|
19
19
|
before do
|
20
|
-
|
21
|
-
message = {hello: "world", test:
|
20
|
+
var_26996240 = TestClass1.new("test")
|
21
|
+
message = {hello: "world", test: var_26996240, arr_1: [1, 2, 3, 4, 5, var_26996240], sub_hash: {yes: true, obj: var_26996240}}
|
22
22
|
@fixture = TestClass1.new(message)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should pass current expectations' do
|
26
26
|
another_object = TestClass1.new("test")
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
var_26989380 = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
|
28
|
+
var_26851780 = Proc.new { |message|
|
29
|
+
var_26989380
|
30
30
|
}
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
test_class_object_return = nil
|
33
|
+
var_26831040 = Proc.new {
|
34
34
|
# Variable return values ... can't figure out what goes in here...
|
35
35
|
}
|
36
36
|
|
@@ -41,11 +41,11 @@ RSpec.describe TestClass1 do
|
|
41
41
|
# TestClass1#print_message should return
|
42
42
|
expect( @fixture.print_message ).to be_nil
|
43
43
|
|
44
|
-
# TestClass1#set_block should return #<Pretentious::RecordedProc:
|
45
|
-
expect( @fixture.set_block &
|
44
|
+
# TestClass1#set_block should return #<Pretentious::RecordedProc:0x0000000332d388@example.rb:73>
|
45
|
+
expect( @fixture.set_block &var_26851780 ).to eq(var_26851780)
|
46
46
|
|
47
|
-
# TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:
|
48
|
-
expect( @fixture.call_block &
|
47
|
+
# TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:0x0000000337da90 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26996300=>"message"}>, :arr_1=>[1, 2, 3, 4, 5, #<TestClass1:0x0000000337da90 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26996300=>"message"}>], :sub_hash=>{:yes=>true, :obj=>#<TestClass1:0x0000000337da90 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26996300=>"message"}>}}
|
48
|
+
expect( @fixture.call_block &var_26831040 ).to eq(var_26989380)
|
49
49
|
|
50
50
|
# TestClass1#something_is_wrong should return StandardError
|
51
51
|
expect { @fixture.something_is_wrong }.to raise_error
|
@@ -56,4 +56,18 @@ RSpec.describe TestClass1 do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
context 'Scenario 3' do
|
60
|
+
before do
|
61
|
+
@fixture = TestClass1.new("Hello")
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should pass current expectations' do
|
65
|
+
another_object = TestClass1.new("test")
|
66
|
+
|
67
|
+
# TestClass1#return_self when passed message = #<TestClass1:0x0000000337da90> should return #<TestClass1:0x0000000337da90>
|
68
|
+
expect( @fixture.return_self(another_object) ).to eq(another_object)
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
59
73
|
end
|
data/spec/test_class3_spec.rb
CHANGED
@@ -5,9 +5,9 @@ RSpec.describe TestClass3 do
|
|
5
5
|
|
6
6
|
context 'Scenario 1' do
|
7
7
|
before do
|
8
|
-
|
9
|
-
|
10
|
-
testclass1 = TestClass1.new(
|
8
|
+
var_26996240 = TestClass1.new("test")
|
9
|
+
var_26989380 = {hello: "world", test: var_26996240, arr_1: [1, 2, 3, 4, 5, var_26996240], sub_hash: {yes: true, obj: var_26996240}}
|
10
|
+
testclass1 = TestClass1.new(var_26989380)
|
11
11
|
testclass2 = TestClass2.new("This is message 2", nil)
|
12
12
|
@fixture = TestClass3.new(testclass1, testclass2)
|
13
13
|
end
|
@@ -21,9 +21,9 @@ RSpec.describe TestClass3 do
|
|
21
21
|
|
22
22
|
context 'Scenario 2' do
|
23
23
|
before do
|
24
|
-
|
25
|
-
|
26
|
-
testclass1 = TestClass1.new(
|
24
|
+
var_26996240 = TestClass1.new("test")
|
25
|
+
var_26989380 = {hello: "world", test: var_26996240, arr_1: [1, 2, 3, 4, 5, var_26996240], sub_hash: {yes: true, obj: var_26996240}}
|
26
|
+
testclass1 = TestClass1.new(var_26989380)
|
27
27
|
testclass2 = TestClass2.new("This is message 2", nil)
|
28
28
|
@fixture = TestClass3.new(testclass1, testclass2)
|
29
29
|
end
|
data/spec/test_class4_spec.rb
CHANGED
@@ -6,11 +6,11 @@ RSpec.describe TestClass4 do
|
|
6
6
|
context 'Scenario 1' do
|
7
7
|
before do
|
8
8
|
var_8 = nil
|
9
|
-
|
9
|
+
var_26873720 = Proc.new {
|
10
10
|
# Variable return values ... can't figure out what goes in here...
|
11
11
|
}
|
12
12
|
|
13
|
-
@fixture = TestClass4.new(&
|
13
|
+
@fixture = TestClass4.new(&var_26873720)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should pass current expectations' do
|
@@ -9,7 +9,7 @@ RSpec.describe TestClassForAutoStub do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should pass current expectations' do
|
12
|
-
|
12
|
+
var_25019620 = ["Hello Glorious world", "HI THERE!!!!"]
|
13
13
|
|
14
14
|
allow_any_instance_of(ClassUsedByTestClass).to receive(:stubbed_method).and_return("Hello Glorious world")
|
15
15
|
allow_any_instance_of(AnotherClassUsedByTestClass).to receive(:get_message).and_return("HI THERE!!!!")
|
@@ -9,7 +9,7 @@ RSpec.describe TestClassForMocks do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should pass current expectations' do
|
12
|
-
|
12
|
+
var_25555900 = [2, 3, 4, 5]
|
13
13
|
|
14
14
|
allow_any_instance_of(TestMockSubClass).to receive(:test_method).and_return("a return string")
|
15
15
|
allow_any_instance_of(TestMockSubClass).to receive(:increment_val).and_return(2, 3, 4, 5)
|
@@ -35,12 +35,12 @@ RSpec.describe TestClassForMocks do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should pass current expectations' do
|
38
|
-
|
38
|
+
var_25477400 = {val: 1, str: "hello world", message: "a message"}
|
39
39
|
|
40
|
-
allow_any_instance_of(TestMockSubClass).to receive(:return_hash).and_return(
|
40
|
+
allow_any_instance_of(TestMockSubClass).to receive(:return_hash).and_return(var_25477400)
|
41
41
|
|
42
42
|
# TestClassForMocks#method_with_usage3 when passed message = "a message" should return {:val=>1, :str=>"hello world", :message=>"a message"}
|
43
|
-
expect( @fixture.method_with_usage3("a message") ).to eq(
|
43
|
+
expect( @fixture.method_with_usage3("a message") ).to eq(var_25477400)
|
44
44
|
|
45
45
|
end
|
46
46
|
end
|
data/test/test_test_class1.rb
CHANGED
@@ -20,20 +20,20 @@ end
|
|
20
20
|
|
21
21
|
class TestClass1Scenario2 < TestTestClass1
|
22
22
|
def setup
|
23
|
-
|
24
|
-
message = {hello: "world", test:
|
23
|
+
var_26398900 = TestClass1.new("test")
|
24
|
+
message = {hello: "world", test: var_26398900, arr_1: [1, 2, 3, 4, 5, var_26398900], sub_hash: {yes: true, obj: var_26398900}}
|
25
25
|
@fixture = TestClass1.new(message)
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_current_expectation
|
29
29
|
another_object = TestClass1.new("test")
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
var_26392980 = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
|
31
|
+
var_26237280 = Proc.new { |message|
|
32
|
+
var_26392980
|
33
33
|
}
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
test_class_object_return = nil
|
36
|
+
var_26216700 = Proc.new {
|
37
37
|
# Variable return values ... can't figure out what goes in here...
|
38
38
|
}
|
39
39
|
|
@@ -44,11 +44,11 @@ class TestClass1Scenario2 < TestTestClass1
|
|
44
44
|
#TestClass1#print_message should return
|
45
45
|
assert_nil @fixture.print_message
|
46
46
|
|
47
|
-
#TestClass1#set_block should return #<Pretentious::RecordedProc:
|
48
|
-
assert_equal
|
47
|
+
#TestClass1#set_block should return #<Pretentious::RecordedProc:0x00000003201568@example.rb:73>
|
48
|
+
assert_equal var_26237280, @fixture.set_block( &var_26237280)
|
49
49
|
|
50
|
-
#TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:
|
51
|
-
assert_equal
|
50
|
+
#TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:0x00000003259fd8 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26398960=>"message"}>, :arr_1=>[1, 2, 3, 4, 5, #<TestClass1:0x00000003259fd8 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26398960=>"message"}>], :sub_hash=>{:yes=>true, :obj=>#<TestClass1:0x00000003259fd8 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={26398960=>"message"}>}}
|
51
|
+
assert_equal var_26392980, @fixture.call_block( &var_26216700)
|
52
52
|
|
53
53
|
#TestClass1#something_is_wrong should return StandardError
|
54
54
|
assert_raises(StandardError) { @fixture.something_is_wrong }
|
@@ -60,3 +60,18 @@ class TestClass1Scenario2 < TestTestClass1
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
+
class TestClass1Scenario3 < TestTestClass1
|
64
|
+
def setup
|
65
|
+
@fixture = TestClass1.new("Hello")
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_current_expectation
|
69
|
+
another_object = TestClass1.new("test")
|
70
|
+
|
71
|
+
#TestClass1#return_self when passed message = #<TestClass1:0x00000003259fd8> should return #<TestClass1:0x00000003259fd8>
|
72
|
+
assert_equal another_object, @fixture.return_self(another_object)
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/test/test_test_class3.rb
CHANGED
@@ -7,9 +7,9 @@ end
|
|
7
7
|
|
8
8
|
class TestClass3Scenario1 < TestTestClass3
|
9
9
|
def setup
|
10
|
-
|
11
|
-
|
12
|
-
testclass1 = TestClass1.new(
|
10
|
+
var_26398900 = TestClass1.new("test")
|
11
|
+
var_26392980 = {hello: "world", test: var_26398900, arr_1: [1, 2, 3, 4, 5, var_26398900], sub_hash: {yes: true, obj: var_26398900}}
|
12
|
+
testclass1 = TestClass1.new(var_26392980)
|
13
13
|
testclass2 = TestClass2.new("This is message 2", nil)
|
14
14
|
@fixture = TestClass3.new(testclass1, testclass2)
|
15
15
|
end
|
@@ -24,9 +24,9 @@ end
|
|
24
24
|
|
25
25
|
class TestClass3Scenario2 < TestTestClass3
|
26
26
|
def setup
|
27
|
-
|
28
|
-
|
29
|
-
testclass1 = TestClass1.new(
|
27
|
+
var_26398900 = TestClass1.new("test")
|
28
|
+
var_26392980 = {hello: "world", test: var_26398900, arr_1: [1, 2, 3, 4, 5, var_26398900], sub_hash: {yes: true, obj: var_26398900}}
|
29
|
+
testclass1 = TestClass1.new(var_26392980)
|
30
30
|
testclass2 = TestClass2.new("This is message 2", nil)
|
31
31
|
@fixture = TestClass3.new(testclass1, testclass2)
|
32
32
|
end
|
data/test/test_test_class4.rb
CHANGED
@@ -8,11 +8,11 @@ end
|
|
8
8
|
class TestClass4Scenario1 < TestTestClass4
|
9
9
|
def setup
|
10
10
|
var_8 = nil
|
11
|
-
|
11
|
+
var_26281680 = Proc.new {
|
12
12
|
# Variable return values ... can't figure out what goes in here...
|
13
13
|
}
|
14
14
|
|
15
|
-
@fixture = TestClass4.new(&
|
15
|
+
@fixture = TestClass4.new(&var_26281680)
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_current_expectation
|
@@ -11,7 +11,7 @@ class TestClassForMocksScenario1 < TestTestClassForMocks
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_current_expectation
|
14
|
-
|
14
|
+
var_25321980 = [2, 3, 4, 5]
|
15
15
|
|
16
16
|
TestMockSubClass.stub_any_instance(:test_method, "a return string") do
|
17
17
|
TestMockSubClass.stub_any_instance(:increment_val, 2) do
|
@@ -39,11 +39,11 @@ class TestClassForMocksScenario2 < TestTestClassForMocks
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_current_expectation
|
42
|
-
|
42
|
+
var_25211620 = {val: 1, str: "hello world", message: "a message"}
|
43
43
|
|
44
|
-
TestMockSubClass.stub_any_instance(:return_hash,
|
44
|
+
TestMockSubClass.stub_any_instance(:return_hash, var_25211620) do
|
45
45
|
#TestClassForMocks#method_with_usage3 when passed message = "a message" should return {:val=>1, :str=>"hello world", :message=>"a message"}
|
46
|
-
assert_equal
|
46
|
+
assert_equal var_25211620, @fixture.method_with_usage3("a message")
|
47
47
|
|
48
48
|
end
|
49
49
|
|
data/test_classes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretentious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Emmanuel Dayo
|
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
179
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
180
|
+
rubygems_version: 2.4.8
|
181
181
|
signing_key:
|
182
182
|
specification_version: 4
|
183
183
|
summary: Generate tests from existing code as well as a way to deal with pretentious
|
@@ -204,4 +204,3 @@ test_files:
|
|
204
204
|
- test/test_test_class3.rb
|
205
205
|
- test/test_test_class4.rb
|
206
206
|
- test/test_test_class_for_mocks.rb
|
207
|
-
has_rdoc:
|