pretentious 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module Pretentious
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pretentious/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pretentious"
8
+ spec.version = Pretentious::VERSION
9
+ spec.authors = ["Joseph Emmanuel Dayo"]
10
+ spec.email = ["joseph.dayo@gmail.com"]
11
+ spec.summary = %q{Gem to deal with pretentious tdd developers}
12
+ spec.description = %q{Do you have a pretentious boss or dev lead that pushes you to embrace tdd but for reasons hate it or them? here is a gem to deal with that.}
13
+ spec.homepage = "https://github.com/jedld/pretentious"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+ spec.add_dependency "binding_of_caller", "~> 0.7.2"
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
data/run_test.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ git add .
4
+ gem build pretentious.gemspec
5
+ gem install pretentious-0.0.1.gem
6
+ ruby test/test_generator.rb
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Fibonacci do
4
+
5
+ context 'Scenario 1' do
6
+ before do
7
+
8
+
9
+ @fixture = Fibonacci.new
10
+
11
+ end
12
+
13
+ it 'should pass current expectations' do
14
+
15
+ n = 1
16
+ n_1 = 2
17
+ n_2 = 3
18
+ n_3 = 4
19
+ n_4 = 5
20
+ n_5 = 6
21
+ n_6 = 7
22
+ n_7 = 8
23
+ n_8 = 9
24
+ n_9 = 10
25
+
26
+ # Fibonacci#fib when passed n = 1 should return 1
27
+ expect( @fixture.fib(n) ).to eq(1)
28
+
29
+ # Fibonacci#fib when passed n = 2 should return 1
30
+ expect( @fixture.fib(n_1) ).to eq(1)
31
+
32
+ # Fibonacci#fib when passed n = 3 should return 2
33
+ expect( @fixture.fib(n_2) ).to eq(2)
34
+
35
+ # Fibonacci#fib when passed n = 4 should return 3
36
+ expect( @fixture.fib(n_3) ).to eq(3)
37
+
38
+ # Fibonacci#fib when passed n = 5 should return 5
39
+ expect( @fixture.fib(n_4) ).to eq(5)
40
+
41
+ # Fibonacci#fib when passed n = 6 should return 8
42
+ expect( @fixture.fib(n_5) ).to eq(8)
43
+
44
+ # Fibonacci#fib when passed n = 7 should return 13
45
+ expect( @fixture.fib(n_6) ).to eq(13)
46
+
47
+ # Fibonacci#fib when passed n = 8 should return 21
48
+ expect( @fixture.fib(n_7) ).to eq(21)
49
+
50
+ # Fibonacci#fib when passed n = 9 should return 34
51
+ expect( @fixture.fib(n_8) ).to eq(34)
52
+
53
+ # Fibonacci#fib when passed n = 10 should return 55
54
+ expect( @fixture.fib(n_9) ).to eq(55)
55
+
56
+ end
57
+ end
58
+
59
+ it 'should pass current expectations' do
60
+
61
+
62
+ # Fibonacci::say_hello when passed should return hello
63
+ expect( Fibonacci.say_hello ).to eq("hello")
64
+
65
+ end
66
+ end
data/spec/m_d5_spec.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Digest::MD5 do
4
+
5
+ it 'should pass current expectations' do
6
+
7
+ sample = "This is the digest"
8
+
9
+ # Digest::MD5::hexdigest when passed "This is the digest" should return 9f12248dcddeda976611d192efaaf72a
10
+ expect( Digest::MD5.hexdigest(sample) ).to eq("9f12248dcddeda976611d192efaaf72a")
11
+
12
+ end
13
+ end
@@ -0,0 +1,63 @@
1
+ require 'digest/md5'
2
+ require 'json'
3
+ require 'pretentious'
4
+
5
+ class Fibonacci
6
+
7
+ def fib(n)
8
+ return 0 if (n == 0)
9
+ return 1 if (n == 1)
10
+ return 1 if (n == 2)
11
+ return fib(n - 1) + fib(n - 2)
12
+ end
13
+
14
+ def self.say_hello
15
+ "hello"
16
+ end
17
+
18
+ end
19
+
20
+
21
+ class TestClass1
22
+
23
+ def initialize(message)
24
+ @message = message
25
+ end
26
+
27
+ def print_message
28
+ puts @message
29
+ end
30
+
31
+ def something_is_wrong
32
+ raise StandardError.new
33
+ end
34
+ end
35
+
36
+ class TestClass2
37
+ def initialize(message)
38
+ @message = {message: message}
39
+ end
40
+
41
+ def print_message
42
+ puts @message[:message]
43
+ end
44
+ end
45
+
46
+ class TestClass3
47
+
48
+ def initialize(testclass1, testclass2)
49
+ @class1 = testclass1
50
+ @class2 = testclass2
51
+ end
52
+
53
+ def get_hash
54
+ {hello: "world", message: {another: :hash}}
55
+ end
56
+
57
+ def show_messages
58
+ @class1.print_message
59
+ @class2.print_message
60
+ "awesome!!!"
61
+ end
62
+
63
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe TestClass1 do
4
+
5
+ context 'Scenario 1' do
6
+ before do
7
+
8
+
9
+ @fixture = TestClass1.new("test")
10
+
11
+ end
12
+
13
+ it 'should pass current expectations' do
14
+
15
+
16
+ end
17
+ end
18
+
19
+ context 'Scenario 2' do
20
+ before do
21
+
22
+ var_2167529620 = "test"
23
+ another_object = TestClass1.new(var_2167529620)
24
+ var_2167516320 = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
25
+
26
+ @fixture = TestClass1.new(var_2167516320)
27
+
28
+ end
29
+
30
+ it 'should pass current expectations' do
31
+
32
+
33
+ # TestClass1#print_message when passed should return
34
+ expect( @fixture.print_message ).to be_nil
35
+
36
+ # TestClass1#print_message when passed should return
37
+ expect( @fixture.print_message ).to be_nil
38
+
39
+ end
40
+ end
41
+
42
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe TestClass2 do
4
+
5
+ context 'Scenario 1' do
6
+ before do
7
+
8
+
9
+ @fixture = TestClass2.new("This is message 2")
10
+
11
+ end
12
+
13
+ it 'should pass current expectations' do
14
+
15
+
16
+ # TestClass2#print_message when passed should return
17
+ expect( @fixture.print_message ).to be_nil
18
+
19
+ # TestClass2#print_message when passed should return
20
+ expect( @fixture.print_message ).to be_nil
21
+
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe TestClass3 do
4
+
5
+ context 'Scenario 1' do
6
+ before do
7
+
8
+ var_2167529620 = "test"
9
+ another_object = TestClass1.new(var_2167529620)
10
+ args = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
11
+ test_class_one = TestClass1.new(args)
12
+ args_1 = "This is message 2"
13
+ test_class_two = TestClass2.new(args_1)
14
+
15
+ @fixture = TestClass3.new(test_class_one, test_class_two)
16
+
17
+ end
18
+
19
+ it 'should pass current expectations' do
20
+
21
+
22
+ # TestClass3#show_messages when passed should return awesome!!!
23
+ expect( @fixture.show_messages ).to eq("awesome!!!")
24
+
25
+ end
26
+ end
27
+
28
+ context 'Scenario 2' do
29
+ before do
30
+
31
+ var_2167529620 = "test"
32
+ another_object = TestClass1.new(var_2167529620)
33
+ args = {hello: "world", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}
34
+ test_class_one = TestClass1.new(args)
35
+ args_1 = "This is message 2"
36
+ test_class_two = TestClass2.new(args_1)
37
+
38
+ @fixture = TestClass3.new(test_class_one, test_class_two)
39
+
40
+ end
41
+
42
+ it 'should pass current expectations' do
43
+
44
+
45
+ # TestClass3#show_messages when passed should return awesome!!!
46
+ expect( @fixture.show_messages ).to eq("awesome!!!")
47
+
48
+ end
49
+ end
50
+
51
+ end
@@ -0,0 +1,105 @@
1
+ require 'pretentious'
2
+ require 'digest/md5'
3
+ require 'json'
4
+
5
+ class Fibonacci
6
+
7
+ def fib(n)
8
+ return 0 if (n == 0)
9
+ return 1 if (n == 1)
10
+ return 1 if (n == 2)
11
+ return fib(n - 1) + fib(n - 2)
12
+ end
13
+
14
+ def self.say_hello
15
+ "hello"
16
+ end
17
+
18
+ end
19
+
20
+
21
+ class TestClass1
22
+
23
+ def initialize(message)
24
+ @message = message
25
+ end
26
+
27
+ def print_message
28
+ puts @message
29
+ end
30
+
31
+ def something_is_wrong
32
+ raise StandardError.new
33
+ end
34
+ end
35
+
36
+ class TestClass2
37
+ def initialize(message)
38
+ @message = {message: message}
39
+ end
40
+
41
+ def print_message
42
+ puts @message[:message]
43
+ end
44
+ end
45
+
46
+ class TestClass3
47
+
48
+ def initialize(testclass1, testclass2)
49
+ @class1 = testclass1
50
+ @class2 = testclass2
51
+ end
52
+
53
+ def show_messages
54
+ @class1.print_message
55
+ @class2.print_message
56
+ "awesome!!!"
57
+ end
58
+
59
+ end
60
+
61
+ #examples
62
+
63
+ results_ddt = Pretentious::Generator.generate_for(Fibonacci) do
64
+
65
+ instance = Fibonacci.new
66
+
67
+ (1..10).each do |n|
68
+ instance.fib(n)
69
+ end
70
+
71
+ Fibonacci.say_hello
72
+ end
73
+
74
+ results_ddt.each_value { |v| puts v}
75
+
76
+ results_md5 = Pretentious::Generator.generate_for(Digest::MD5) do
77
+ sample = "This is the digest"
78
+ Digest::MD5.hexdigest(sample)
79
+ end
80
+
81
+ results_md5.each_value { |v| puts v}
82
+
83
+ results_composition = Pretentious::Generator.generate_for(TestClass3, TestClass2, TestClass1) do
84
+ another_object = TestClass1.new("test")
85
+ test_class_one = TestClass1.new({hello: "world", test: another_object, arr_1: [1,2,3,4,5, another_object],
86
+ sub_hash: {yes: true, obj: another_object}})
87
+ test_class_two = TestClass2.new("This is message 2")
88
+
89
+ class_to_test = TestClass3.new(test_class_one, test_class_two)
90
+ class_to_test.show_messages
91
+
92
+ class_to_test = TestClass3.new(test_class_one, test_class_two)
93
+ class_to_test.show_messages
94
+
95
+ puts another_object._deconstruct_to_ruby
96
+
97
+ begin
98
+ another_object.something_is_wrong
99
+ rescue Exception=>e
100
+ end
101
+
102
+
103
+ end
104
+
105
+ results_composition.each_value { |v| puts v}
@@ -0,0 +1 @@
1
+ ["RSpec.describe TestClass3 do\n\n context 'Scenario 1' do\n before do\n\n var_2172810880 = \"test\"\n another_object = TestClass1.new(var_2172810880)\n message = {hello: \"world\", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}\n test_class_one = TestClass1.new(message)\n message_1 = \"This is message 2\"\n test_class_two = TestClass2.new(message_1)\n\n @fixture = TestClass3.new(test_class_one, test_class_two)\n\n end\n\n it 'should pass current expectations' do\n\n\n # TestClass3#show_messages when passed should return awesome!!!\n expect ( @fixture.show_messages ).to equal(\"awesome!!!\")\n\n end\n end\n\n context 'Scenario 2' do\n before do\n\n var_2172810880 = \"test\"\n another_object = TestClass1.new(var_2172810880)\n message = {hello: \"world\", test: another_object, arr_1: [1, 2, 3, 4, 5, another_object], sub_hash: {yes: true, obj: another_object}}\n test_class_one = TestClass1.new(message)\n message_1 = \"This is message 2\"\n test_class_two = TestClass2.new(message_1)\n\n @fixture = TestClass3.new(test_class_one, test_class_two)\n\n end\n\n it 'should pass current expectations' do\n\n\n # TestClass3#show_messages when passed should return awesome!!!\n expect ( @fixture.show_messages ).to equal(\"awesome!!!\")\n\n end\n end\n\nend\n"]
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pretentious
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joseph Emmanuel Dayo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: binding_of_caller
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Do you have a pretentious boss or dev lead that pushes you to embrace
56
+ tdd but for reasons hate it or them? here is a gem to deal with that.
57
+ email:
58
+ - joseph.dayo@gmail.com
59
+ executables:
60
+ - ddtgen
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - bin/ddtgen
70
+ - example.rb
71
+ - lib/pretentious.rb
72
+ - lib/pretentious/deconstructor.rb
73
+ - lib/pretentious/rspec_generator.rb
74
+ - lib/pretentious/version.rb
75
+ - pretentious.gemspec
76
+ - run_test.sh
77
+ - spec/fibonacci_spec.rb
78
+ - spec/m_d5_spec.rb
79
+ - spec/spec_helper.rb
80
+ - spec/test_class1_spec.rb
81
+ - spec/test_class2_spec.rb
82
+ - spec/test_class3_spec.rb
83
+ - test/test_generator.rb
84
+ - test_class3_spec.rb
85
+ homepage: https://github.com/jedld/pretentious
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.2.2
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Gem to deal with pretentious tdd developers
109
+ test_files:
110
+ - spec/fibonacci_spec.rb
111
+ - spec/m_d5_spec.rb
112
+ - spec/spec_helper.rb
113
+ - spec/test_class1_spec.rb
114
+ - spec/test_class2_spec.rb
115
+ - spec/test_class3_spec.rb
116
+ - test/test_generator.rb
117
+ has_rdoc: