pretentious 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/ddtgen +12 -8
- data/example.rb +7 -1
- data/lib/pretentious.rb +8 -6
- data/lib/pretentious/deconstructor.rb +70 -15
- data/lib/pretentious/generator.rb +19 -11
- data/lib/pretentious/generator_base.rb +13 -0
- data/lib/pretentious/minitest_generator.rb +4 -34
- data/lib/pretentious/rspec_generator.rb +9 -38
- data/lib/pretentious/version.rb +1 -1
- data/pretentious.gemspec +1 -0
- data/spec/deconstructor_spec.rb +40 -7
- data/spec/fibonacci_spec.rb +0 -4
- data/spec/generator_spec.rb +69 -0
- data/spec/m_d5_spec.rb +0 -1
- data/spec/minitest_generator_spec.rb +1 -1
- data/spec/prententious_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/test_class1_spec.rb +13 -22
- data/spec/test_class2_spec.rb +27 -5
- data/spec/test_class3_spec.rb +11 -22
- data/spec/test_class4_spec.rb +5 -8
- data/spec/test_class_for_auto_stub_spec.rb +1 -4
- data/spec/test_class_for_mocks_spec.rb +5 -10
- data/test/test_generator.rb +1 -1
- data/test/test_meme.rb +1 -2
- data/test/test_test_class1.rb +14 -19
- data/test/test_test_class2.rb +29 -3
- data/test/test_test_class3.rb +12 -20
- data/test/test_test_class4.rb +5 -6
- data/test/test_test_class_for_mocks.rb +6 -8
- data/test_classes.rb +9 -1
- metadata +17 -2
data/test/test_generator.rb
CHANGED
data/test/test_meme.rb
CHANGED
@@ -5,13 +5,12 @@ require "minitest/autorun"
|
|
5
5
|
class TestMeme < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class MemeScenario1 < TestMeme
|
9
9
|
def setup
|
10
10
|
@fixture = Meme.new
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_current_expectation
|
14
|
-
|
15
14
|
#Meme#i_can_has_cheezburger? should return OHAI!
|
16
15
|
assert_equal "OHAI!", @fixture.i_can_has_cheezburger?
|
17
16
|
|
data/test/test_test_class1.rb
CHANGED
@@ -5,13 +5,12 @@ require "minitest/autorun"
|
|
5
5
|
class TestTestClass1 < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestClass1Scenario1 < TestTestClass1
|
9
9
|
def setup
|
10
10
|
@fixture = TestClass1.new("test")
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_current_expectation
|
14
|
-
|
15
14
|
#TestClass1#message should return test
|
16
15
|
assert_equal "test", @fixture.message
|
17
16
|
|
@@ -19,26 +18,22 @@ class Scenario1 < TestTestClass1
|
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
|
-
class
|
21
|
+
class TestClass1Scenario2 < TestTestClass1
|
23
22
|
def setup
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@fixture = TestClass1.new(var_2175159080)
|
23
|
+
var_2167808880 = TestClass1.new("test")
|
24
|
+
message = {hello: "world", test: var_2167808880, arr_1: [1, 2, 3, 4, 5, var_2167808880], sub_hash: {yes: true, obj: var_2167808880}}
|
25
|
+
@fixture = TestClass1.new(message)
|
29
26
|
end
|
30
27
|
|
31
28
|
def test_current_expectation
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
var_2175057940 = Proc.new { |message|
|
37
|
-
var_2175159080
|
29
|
+
another_object = TestClass1.new("test")
|
30
|
+
var_2167802520 = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
|
31
|
+
var_2167669280 = Proc.new { |message|
|
32
|
+
var_2167802520
|
38
33
|
}
|
39
34
|
|
40
35
|
e = nil
|
41
|
-
|
36
|
+
var_2161039260 = Proc.new {
|
42
37
|
# Variable return values ... can't figure out what goes in here...
|
43
38
|
}
|
44
39
|
|
@@ -49,11 +44,11 @@ class Scenario2 < TestTestClass1
|
|
49
44
|
#TestClass1#print_message should return
|
50
45
|
assert_nil @fixture.print_message
|
51
46
|
|
52
|
-
#TestClass1#set_block should return #<Pretentious::RecordedProc:
|
53
|
-
assert_equal
|
47
|
+
#TestClass1#set_block should return #<Pretentious::RecordedProc:0x000001019d9980@example.rb:73>
|
48
|
+
assert_equal var_2167669280, @fixture.set_block( &var_2167669280)
|
54
49
|
|
55
|
-
#TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:
|
56
|
-
assert_equal
|
50
|
+
#TestClass1#call_block should return {:hello=>"world", :test=>#<TestClass1:0x000001026c45a0 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={2167808940=>"message"}>, :arr_1=>[1, 2, 3, 4, 5, #<TestClass1:0x000001026c45a0 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={2167808940=>"message"}>], :sub_hash=>{:yes=>true, :obj=>#<TestClass1:0x000001026c45a0 @message="test", @_init_arguments={:params=>["test"], :params_types=>[[:req, :message]]}, @_variable_names={2167808940=>"message"}>}}
|
51
|
+
assert_equal var_2167802520, @fixture.call_block( &var_2161039260)
|
57
52
|
|
58
53
|
#TestClass1#something_is_wrong should return StandardError
|
59
54
|
assert_raises(StandardError) { @fixture.something_is_wrong }
|
data/test/test_test_class2.rb
CHANGED
@@ -5,13 +5,12 @@ require "minitest/autorun"
|
|
5
5
|
class TestTestClass2 < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestClass2Scenario1 < TestTestClass2
|
9
9
|
def setup
|
10
|
-
@fixture = TestClass2.new("This is message 2")
|
10
|
+
@fixture = TestClass2.new("This is message 2", nil)
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_current_expectation
|
14
|
-
|
15
14
|
#TestClass2#print_message should return
|
16
15
|
assert_nil @fixture.print_message
|
17
16
|
|
@@ -22,3 +21,30 @@ class Scenario1 < TestTestClass2
|
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
24
|
+
class TestClass2Scenario2 < TestTestClass2
|
25
|
+
def setup
|
26
|
+
@fixture = TestClass2.new("This is message 3", nil)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_current_expectation
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class TestClass2Scenario3 < TestTestClass2
|
35
|
+
def setup
|
36
|
+
message2 = "This is message 3"
|
37
|
+
message = TestClass2.new(message2, nil)
|
38
|
+
@fixture = TestClass2.new(message, message2)
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_current_expectation
|
42
|
+
message3 = "This is message 3"
|
43
|
+
|
44
|
+
#TestClass2#test when passed object = "This is message 3" should return This is message 3
|
45
|
+
assert_equal "This is message 3", @fixture.test(message3)
|
46
|
+
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
data/test/test_test_class3.rb
CHANGED
@@ -5,20 +5,16 @@ require "minitest/autorun"
|
|
5
5
|
class TestTestClass3 < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestClass3Scenario1 < TestTestClass3
|
9
9
|
def setup
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
test_class_two = TestClass2.new(args_1)
|
16
|
-
|
17
|
-
@fixture = TestClass3.new(test_class_one, test_class_two)
|
10
|
+
var_2167808880 = TestClass1.new("test")
|
11
|
+
var_2167802520 = {hello: "world", test: var_2167808880, arr_1: [1, 2, 3, 4, 5, var_2167808880], sub_hash: {yes: true, obj: var_2167808880}}
|
12
|
+
testclass1 = TestClass1.new(var_2167802520)
|
13
|
+
testclass2 = TestClass2.new("This is message 2", nil)
|
14
|
+
@fixture = TestClass3.new(testclass1, testclass2)
|
18
15
|
end
|
19
16
|
|
20
17
|
def test_current_expectation
|
21
|
-
|
22
18
|
#TestClass3#show_messages should return awesome!!!
|
23
19
|
assert_equal "awesome!!!", @fixture.show_messages
|
24
20
|
|
@@ -26,20 +22,16 @@ class Scenario1 < TestTestClass3
|
|
26
22
|
end
|
27
23
|
end
|
28
24
|
|
29
|
-
class
|
25
|
+
class TestClass3Scenario2 < TestTestClass3
|
30
26
|
def setup
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
test_class_two = TestClass2.new(args_1)
|
37
|
-
|
38
|
-
@fixture = TestClass3.new(test_class_one, test_class_two)
|
27
|
+
var_2167808880 = TestClass1.new("test")
|
28
|
+
var_2167802520 = {hello: "world", test: var_2167808880, arr_1: [1, 2, 3, 4, 5, var_2167808880], sub_hash: {yes: true, obj: var_2167808880}}
|
29
|
+
testclass1 = TestClass1.new(var_2167802520)
|
30
|
+
testclass2 = TestClass2.new("This is message 2", nil)
|
31
|
+
@fixture = TestClass3.new(testclass1, testclass2)
|
39
32
|
end
|
40
33
|
|
41
34
|
def test_current_expectation
|
42
|
-
|
43
35
|
#TestClass3#show_messages should return awesome!!!
|
44
36
|
assert_equal "awesome!!!", @fixture.show_messages
|
45
37
|
|
data/test/test_test_class4.rb
CHANGED
@@ -5,15 +5,14 @@ require "minitest/autorun"
|
|
5
5
|
class TestTestClass4 < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestClass4Scenario1 < TestTestClass4
|
9
9
|
def setup
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
var_8 = nil
|
11
|
+
var_2167689280 = Proc.new {
|
12
|
+
# Variable return values ... can't figure out what goes in here...
|
13
13
|
}
|
14
14
|
|
15
|
-
|
16
|
-
@fixture = TestClass4.new &var_2175076740
|
15
|
+
@fixture = TestClass4.new(&var_2167689280)
|
17
16
|
end
|
18
17
|
|
19
18
|
def test_current_expectation
|
@@ -5,14 +5,13 @@ require "minitest/autorun"
|
|
5
5
|
class TestTestClassForMocks < Minitest::Test
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TestClassForMocksScenario1 < TestTestClassForMocks
|
9
9
|
def setup
|
10
10
|
@fixture = TestClassForMocks.new
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_current_expectation
|
14
|
-
|
15
|
-
var_2162327080 = [2, 3, 4, 5]
|
14
|
+
var_2174075580 = [2, 3, 4, 5]
|
16
15
|
|
17
16
|
TestMockSubClass.stub_any_instance(:test_method, "a return string") do
|
18
17
|
TestMockSubClass.stub_any_instance(:increment_val, 2) do
|
@@ -34,18 +33,17 @@ class Scenario1 < TestTestClassForMocks
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
class
|
36
|
+
class TestClassForMocksScenario2 < TestTestClassForMocks
|
38
37
|
def setup
|
39
38
|
@fixture = TestClassForMocks.new
|
40
39
|
end
|
41
40
|
|
42
41
|
def test_current_expectation
|
42
|
+
var_2167328180 = {val: 1, str: "hello world", message: "a message"}
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
TestMockSubClass.stub_any_instance(:return_hash, var_2174209040) do
|
44
|
+
TestMockSubClass.stub_any_instance(:return_hash, var_2167328180) do
|
47
45
|
#TestClassForMocks#method_with_usage3 when passed message = "a message" should return {:val=>1, :str=>"hello world", :message=>"a message"}
|
48
|
-
assert_equal
|
46
|
+
assert_equal var_2167328180, @fixture.method_with_usage3("a message")
|
49
47
|
|
50
48
|
end
|
51
49
|
|
data/test_classes.rb
CHANGED
@@ -62,13 +62,17 @@ end
|
|
62
62
|
|
63
63
|
|
64
64
|
class TestClass2
|
65
|
-
def initialize(message)
|
65
|
+
def initialize(message, message2)
|
66
66
|
@message = {message: message}
|
67
67
|
end
|
68
68
|
|
69
69
|
def print_message
|
70
70
|
puts @message[:message]
|
71
71
|
end
|
72
|
+
|
73
|
+
def test(object)
|
74
|
+
object
|
75
|
+
end
|
72
76
|
end
|
73
77
|
|
74
78
|
class TestClass3
|
@@ -84,6 +88,10 @@ class TestClass3
|
|
84
88
|
"awesome!!!"
|
85
89
|
end
|
86
90
|
|
91
|
+
def change_message(message)
|
92
|
+
"#{message}!"
|
93
|
+
end
|
94
|
+
|
87
95
|
def swap_hash(j, &block)
|
88
96
|
h = []
|
89
97
|
j.each do |k,v|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Emmanuel Dayo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: binding_of_caller
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: awesome_print
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Do you have a pretentious boss or dev lead that pushes you to embrace
|
98
112
|
tdd but for reasons hate it or them? here is a gem to deal with that.
|
99
113
|
email:
|
@@ -113,6 +127,7 @@ files:
|
|
113
127
|
- lib/pretentious.rb
|
114
128
|
- lib/pretentious/deconstructor.rb
|
115
129
|
- lib/pretentious/generator.rb
|
130
|
+
- lib/pretentious/generator_base.rb
|
116
131
|
- lib/pretentious/minitest_generator.rb
|
117
132
|
- lib/pretentious/recorded_proc.rb
|
118
133
|
- lib/pretentious/rspec_generator.rb
|