salesforce_certification_calculator 0.1.0
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 +7 -0
- data/README.md +114 -0
- data/Rakefile +15 -0
- data/bin/salesforce_certification_calculator +5 -0
- data/data/Administrator-Spring2022.xml +40 -0
- data/data/AdvancedAdministrator-Spring2022.xml +40 -0
- data/data/B2BSolutionArchitect-Spring2022.xml +30 -0
- data/data/B2CSolutionArchitect-Spring2022.xml +30 -0
- data/data/DataArchitect-Spring2022.xml +35 -0
- data/data/DevelopmentLifecycleAndDeploymentArchitect-Spring2022.xml +45 -0
- data/data/EducationCloudConsultant-Spring2022.xml +35 -0
- data/data/ExperienceCloudConsultant-Spring2022.xml +45 -0
- data/data/IdentityAndAccessManagementArchitect-Spring2022.xml +35 -0
- data/data/IntegrationArchitect-Spring2022.xml +35 -0
- data/data/JavaScriptDeveloperI-Spring2022.xml +40 -0
- data/data/MarketingCloudAdministrator-Spring2022.xml +30 -0
- data/data/MarketingCloudConsultant-Spring2022.xml +35 -0
- data/data/MarketingCloudDeveloper-Spring2022.xml +30 -0
- data/data/MarketingCloudEmailSpecialist-Spring2022.xml +30 -0
- data/data/PlatformAppBuilder-Spring2022.xml +30 -0
- data/data/PlatformDeveloperI-Spring2022.xml +25 -0
- data/data/PlatformDeveloperII-Spring2022.xml +30 -0
- data/data/SalesCloudConsultant-Spring2022.xml +55 -0
- data/data/ServiceCloudConsultant-Spring2022.xml +50 -0
- data/data/SharingAndVisibilityArchitect-Spring2022.xml +20 -0
- data/lib/salesforce_certification_calculator/exam.rb +63 -0
- data/lib/salesforce_certification_calculator/file_reader.rb +53 -0
- data/lib/salesforce_certification_calculator/section.rb +25 -0
- data/lib/salesforce_certification_calculator/u_i.rb +107 -0
- data/lib/salesforce_certification_calculator.rb +92 -0
- data/test/test_exam.rb +498 -0
- data/test/test_file_reader.rb +65 -0
- data/test/test_salesforce_certification_calculator.rb +189 -0
- data/test/test_section.rb +59 -0
- data/test/test_u_i.rb +297 -0
- metadata +98 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "salesforce_certification_calculator"
|
3
|
+
|
4
|
+
class SalesforceTest < Minitest::Test
|
5
|
+
SFC = SalesforceCertificationCalculator
|
6
|
+
@@calculator = SFC.new
|
7
|
+
@@methods = @@calculator.methods
|
8
|
+
|
9
|
+
def test_initialize_exam_exists
|
10
|
+
assert_includes @@methods, :exam, "should create an object with an exam attribute"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_initialize_exam_type
|
14
|
+
assert_instance_of SFC::Exam, @@calculator.exam, "should create an object with an exam attribute of type Exam"
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_generate_exams_list_exists
|
18
|
+
assert_includes @@methods, :generate_exams_list, "should create an object with a method called generate_exams_list"
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_extract_initial_exam_data_exists
|
22
|
+
assert_includes @@methods, :extract_initial_exam_data, "should create an object with a method called extract_initial_exam_data"
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_calculate_total_exists
|
26
|
+
assert_includes @@methods, :calculate_total, "should create an object with a method called calculate_total"
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_generate_exams_list_makes_exams_attribute_contain_21_items
|
30
|
+
@@calculator.generate_exams_list
|
31
|
+
|
32
|
+
assert_equal 21, @@calculator.exams.length, "should make exams attribute contain 21 elements when invoke generate_exams_list"
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_generate_exams_list_makes_exams_attribute_contain_exams
|
36
|
+
@@calculator.generate_exams_list
|
37
|
+
|
38
|
+
@@calculator.exams.each do |exam|
|
39
|
+
assert_instance_of SFC::Exam, exam, "should make exams attribute contain Exam objects when invoke generate_exams_list"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_generate_exams_list_contains_no_sections
|
44
|
+
@@calculator.generate_exams_list
|
45
|
+
|
46
|
+
@@calculator.exams.each do |exam|
|
47
|
+
assert_equal 0, exam.sections.length, "should not fill any sections on any of the exams now included in the attribute"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_generate_exams_list_contains_administrator
|
52
|
+
@@calculator.generate_exams_list
|
53
|
+
|
54
|
+
exists = @@calculator.exams.any? { |exam| exam.title == "Administrator - Spring 2022" }
|
55
|
+
|
56
|
+
assert_equal true, exists, "should set exams attribute to an array containing one exam with the Administrator title when invoke generate_exams_list"
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_generate_exams_list_contains_multiple_marketings
|
60
|
+
@@calculator.generate_exams_list
|
61
|
+
marketings = 0
|
62
|
+
|
63
|
+
@@calculator.exams.each do |exam|
|
64
|
+
if exam.title.include? "Marketing"
|
65
|
+
marketings += 1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
assert_operator marketings, :>, 1, "should set exams attribute to an array containing multiple objects with titles including Marketing when invoke generate_exams_list"
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_extract_initial_exam_data_sets_exam_sections
|
73
|
+
@@calculator.generate_exams_list
|
74
|
+
@@calculator.exam = @@calculator.exams[0]
|
75
|
+
@@calculator.extract_initial_exam_data
|
76
|
+
|
77
|
+
assert_operator @@calculator.exam.sections.length, :>, 0, "should populate sections on exam attribute when invoke extract_initial_exam_data"
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_calculate_total_returns_final_score
|
81
|
+
@@calculator.generate_exams_list
|
82
|
+
@@calculator.exam = @@calculator.exams[0]
|
83
|
+
@@calculator.extract_initial_exam_data
|
84
|
+
|
85
|
+
@@calculator.exam.sections.each do |section|
|
86
|
+
section.score = 70
|
87
|
+
end
|
88
|
+
|
89
|
+
result = @@calculator.calculate_total
|
90
|
+
|
91
|
+
assert_equal 70, result, "should return final score when invoke calculate_total"
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_determine_percentage_manually_list_returns_float
|
95
|
+
calculator = SFC.new
|
96
|
+
result = 0
|
97
|
+
|
98
|
+
OStreamCatcher.catch do
|
99
|
+
string_io = StringIO.new
|
100
|
+
string_io.puts "LIST"
|
101
|
+
string_io.puts "1"
|
102
|
+
|
103
|
+
(0..6).each do |i|
|
104
|
+
string_io.puts "80"
|
105
|
+
end
|
106
|
+
|
107
|
+
string_io.rewind
|
108
|
+
$stdin = string_io
|
109
|
+
result = calculator.determine_percentage_manually
|
110
|
+
$stdin = STDIN
|
111
|
+
end
|
112
|
+
|
113
|
+
assert_instance_of Float, result, "should return a float after calling determine_percentage_manually if user selects LIST"
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_determine_percentage_manually_prompts_2_more_than_sections_if_list
|
117
|
+
calculator = SFC.new
|
118
|
+
sections = 7
|
119
|
+
prompts = 2 + sections
|
120
|
+
|
121
|
+
result = OStreamCatcher.catch do
|
122
|
+
string_io = StringIO.new
|
123
|
+
string_io.puts "LIST"
|
124
|
+
string_io.puts "1"
|
125
|
+
|
126
|
+
(1..sections).each do |i|
|
127
|
+
string_io.puts "80"
|
128
|
+
end
|
129
|
+
|
130
|
+
string_io.rewind
|
131
|
+
$stdin = string_io
|
132
|
+
result = calculator.determine_percentage_manually
|
133
|
+
$stdin = STDIN
|
134
|
+
end
|
135
|
+
|
136
|
+
assert_equal prompts, result[1].scan("?").length, "should prompt user for input 2 more than the number of sections in exam when call determine_percentage_manually and LIST selected"
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_determine_percentage_manually_new_returns_float
|
140
|
+
calculator = SFC.new
|
141
|
+
result = 0
|
142
|
+
|
143
|
+
OStreamCatcher.catch do
|
144
|
+
string_io = StringIO.new
|
145
|
+
string_io.puts "NEW"
|
146
|
+
string_io.puts "My Test"
|
147
|
+
string_io.puts "4"
|
148
|
+
|
149
|
+
(1..4).each do |i|
|
150
|
+
string_io.puts "Section #{i}"
|
151
|
+
string_io.puts "25"
|
152
|
+
string_io.puts "70"
|
153
|
+
end
|
154
|
+
|
155
|
+
string_io.rewind
|
156
|
+
$stdin = string_io
|
157
|
+
result = calculator.determine_percentage_manually
|
158
|
+
$stdin = STDIN
|
159
|
+
end
|
160
|
+
|
161
|
+
assert_instance_of Float, result, "should return a float after calling determine_percentage_manually if user selects NEW"
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_determine_percentage_manually_prompts_3_more_than_3_times_sections_if_new
|
165
|
+
calculator = SFC.new
|
166
|
+
sections = 4
|
167
|
+
prompts = 3 + 3 * sections
|
168
|
+
|
169
|
+
result = OStreamCatcher.catch do
|
170
|
+
string_io = StringIO.new
|
171
|
+
string_io.puts "NEW"
|
172
|
+
string_io.puts "My Test"
|
173
|
+
string_io.puts "#{sections}"
|
174
|
+
|
175
|
+
(1..sections).each do |i|
|
176
|
+
string_io.puts "Section #{i}"
|
177
|
+
string_io.puts "25"
|
178
|
+
string_io.puts "70"
|
179
|
+
end
|
180
|
+
|
181
|
+
string_io.rewind
|
182
|
+
$stdin = string_io
|
183
|
+
result = calculator.determine_percentage_manually
|
184
|
+
$stdin = STDIN
|
185
|
+
end
|
186
|
+
|
187
|
+
assert_equal prompts, result[1].scan("?").length, "should prompt user for input 3 more than 3 times the number of sections in exam when call determine_percentage_manually and NEW selected"
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "salesforce_certification_calculator"
|
3
|
+
|
4
|
+
class SectionTest < Minitest::Test
|
5
|
+
Section = SalesforceCertificationCalculator::Section
|
6
|
+
@@name = "Section 1"
|
7
|
+
@@weight = 40
|
8
|
+
@@score = 80
|
9
|
+
@@section = Section.new(@@name, @@weight, @@score)
|
10
|
+
@@methods = @@section.methods
|
11
|
+
|
12
|
+
def test_initialize_name_exists
|
13
|
+
assert_includes @@methods, :name, "should create an object with a name attribute"
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_initialize_name_setter
|
17
|
+
assert_includes @@methods, :name=, "should create an object with a method for setting the name attribute"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_initialize_name_string
|
21
|
+
assert_instance_of String, @@section.name, "should create an object with a name attribute of type string"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_initialize_name_matches_parameter
|
25
|
+
assert_equal @@name, @@section.name, "should create an object with a name attribute matching the first argument to its new call"
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_initialize_weight_exists
|
29
|
+
assert_includes @@methods, :weight, "should create an object with a weight attribute"
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_initialize_weight_setter
|
33
|
+
assert_includes @@methods, :weight=, "should create an object with a method for setting the weight attribute"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_initialize_weight_integer
|
37
|
+
assert_instance_of Integer, @@section.weight, "should create an object with a weight attribute of type integer"
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_initialize_weight_matches_parameter
|
41
|
+
assert_equal @@weight, @@section.weight, "should create an object with a weight attribute matching the second argument to its new call"
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_initialize_score_exists
|
45
|
+
assert_includes @@methods, :score, "should create an object with a score attribute"
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_initialize_score_setter
|
49
|
+
assert_includes @@methods, :score=, "should create an object with a method for setting the score attribute"
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_initialize_score_integer
|
53
|
+
assert_instance_of Integer, @@section.score, "should create an object with a score attribute of type integer"
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_initialize_score_matches_parameter
|
57
|
+
assert_equal @@score, @@section.score, "should create an object with a score attribute matching the last argument to its new call"
|
58
|
+
end
|
59
|
+
end
|
data/test/test_u_i.rb
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "stringio"
|
3
|
+
require "o_stream_catcher"
|
4
|
+
require "salesforce_certification_calculator"
|
5
|
+
|
6
|
+
class UITest < Minitest::Test
|
7
|
+
UI = SalesforceCertificationCalculator::UI
|
8
|
+
FR = SalesforceCertificationCalculator::FileReader
|
9
|
+
Exam = SalesforceCertificationCalculator::Exam
|
10
|
+
reader = FR.new
|
11
|
+
@@ui = UI.new
|
12
|
+
@@exams = reader.generate_exams_list
|
13
|
+
@@methods = @@ui.methods
|
14
|
+
|
15
|
+
def test_select_list_or_new_exists
|
16
|
+
assert_includes @@methods, :select_list_or_new, "should create an object with a method called select_list_or_new"
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_select_specific_exam_exists
|
20
|
+
assert_includes @@methods, :select_specific_exam, "should create an object with a method called select_specific_exam"
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_provide_scores_exists
|
24
|
+
assert_includes @@methods, :provide_scores, "should create an object with a method called provide_scores"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_provide_all_details_manually_exists
|
28
|
+
assert_includes @@methods, :provide_all_details_manually, "should create an object with a method called provide_all_details_manually"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_select_list_or_new_returns_string
|
32
|
+
choice = ""
|
33
|
+
|
34
|
+
OStreamCatcher.catch do
|
35
|
+
string_io = StringIO.new
|
36
|
+
string_io.puts "LIST"
|
37
|
+
string_io.rewind
|
38
|
+
$stdin = string_io
|
39
|
+
choice = @@ui.select_list_or_new
|
40
|
+
$stdin = STDIN
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_instance_of String, choice, "should return string after calling select_list_or_new"
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_select_list_or_new_returns_list
|
47
|
+
choice = ""
|
48
|
+
|
49
|
+
OStreamCatcher.catch do
|
50
|
+
string_io = StringIO.new
|
51
|
+
string_io.puts "LIST"
|
52
|
+
string_io.rewind
|
53
|
+
$stdin = string_io
|
54
|
+
choice = @@ui.select_list_or_new
|
55
|
+
$stdin = STDIN
|
56
|
+
end
|
57
|
+
|
58
|
+
assert_equal "LIST", choice, "should return LIST after calling select_list_or_new if user inputted LIST"
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_select_list_or_new_called_once_if_list
|
62
|
+
result = OStreamCatcher.catch do
|
63
|
+
string_io = StringIO.new
|
64
|
+
string_io.puts "LIST"
|
65
|
+
string_io.rewind
|
66
|
+
$stdin = string_io
|
67
|
+
@@ui.select_list_or_new
|
68
|
+
$stdin = STDIN
|
69
|
+
end
|
70
|
+
|
71
|
+
assert_equal 1, result[1].scan("Do you want to select").length, "should only call select_list_or_new once if user inputted LIST"
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_select_list_or_new_returns_new
|
75
|
+
choice = ""
|
76
|
+
|
77
|
+
OStreamCatcher.catch do
|
78
|
+
string_io = StringIO.new
|
79
|
+
string_io.puts "NEW"
|
80
|
+
string_io.rewind
|
81
|
+
$stdin = string_io
|
82
|
+
choice = @@ui.select_list_or_new
|
83
|
+
$stdin = STDIN
|
84
|
+
end
|
85
|
+
|
86
|
+
assert_equal "NEW", choice, "should return NEW after calling select_list_or_new if user inputted NEW"
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_select_list_or_new_called_once_if_new
|
90
|
+
result = OStreamCatcher.catch do
|
91
|
+
string_io = StringIO.new
|
92
|
+
string_io.puts "NEW"
|
93
|
+
string_io.rewind
|
94
|
+
$stdin = string_io
|
95
|
+
@@ui.select_list_or_new
|
96
|
+
$stdin = STDIN
|
97
|
+
end
|
98
|
+
|
99
|
+
assert_equal 1, result[1].scan("Do you want to select").length, "should only call select_list_or_new once if user inputted NEW"
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_select_list_or_new_recursion
|
103
|
+
result = OStreamCatcher.catch do
|
104
|
+
string_io = StringIO.new
|
105
|
+
string_io.puts "a"
|
106
|
+
string_io.puts "NEW"
|
107
|
+
string_io.rewind
|
108
|
+
$stdin = string_io
|
109
|
+
@@ui.select_list_or_new
|
110
|
+
$stdin = STDIN
|
111
|
+
end
|
112
|
+
|
113
|
+
assert_operator result[1].scan("Do you want to select").length, :>, 1, "should call select_list_or_new more than once if user initially inputted something other than LIST or NEW"
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_select_specific_exam_returns_exam
|
117
|
+
choice = {}
|
118
|
+
|
119
|
+
OStreamCatcher.catch do
|
120
|
+
string_io = StringIO.new
|
121
|
+
string_io.puts "1"
|
122
|
+
string_io.rewind
|
123
|
+
$stdin = string_io
|
124
|
+
choice = @@ui.select_specific_exam(@@exams)
|
125
|
+
$stdin = STDIN
|
126
|
+
end
|
127
|
+
|
128
|
+
assert_instance_of Exam, choice, "should return Exam object after calling select_specific_exam"
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_select_specific_exam_returns_first_if_1
|
132
|
+
choice = {}
|
133
|
+
|
134
|
+
OStreamCatcher.catch do
|
135
|
+
string_io = StringIO.new
|
136
|
+
string_io.puts "1"
|
137
|
+
string_io.rewind
|
138
|
+
$stdin = string_io
|
139
|
+
choice = @@ui.select_specific_exam(@@exams)
|
140
|
+
$stdin = STDIN
|
141
|
+
end
|
142
|
+
|
143
|
+
assert_equal @@exams[0], choice, "should return first Exam object in exams array after calling select_specific_exam if 1 inputted"
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_select_specific_exam_called_once_if_1
|
147
|
+
result = OStreamCatcher.catch do
|
148
|
+
string_io = StringIO.new
|
149
|
+
string_io.puts "1"
|
150
|
+
string_io.rewind
|
151
|
+
$stdin = string_io
|
152
|
+
@@ui.select_specific_exam(@@exams)
|
153
|
+
$stdin = STDIN
|
154
|
+
end
|
155
|
+
|
156
|
+
assert_equal 1, result[1].scan("Which one would you like to select").length, "should call select_specific_exam only once if user inputs 1"
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_select_specific_exam_returns_second_if_2
|
160
|
+
choice = {}
|
161
|
+
|
162
|
+
OStreamCatcher.catch do
|
163
|
+
string_io = StringIO.new
|
164
|
+
string_io.puts "2"
|
165
|
+
string_io.rewind
|
166
|
+
$stdin = string_io
|
167
|
+
choice = @@ui.select_specific_exam(@@exams)
|
168
|
+
$stdin = STDIN
|
169
|
+
end
|
170
|
+
|
171
|
+
assert_equal @@exams[1], choice, "should return second Exam object in exams array after calling select_specific_exam if 2 inputted"
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_select_specific_exam_called_once_if_2
|
175
|
+
result = OStreamCatcher.catch do
|
176
|
+
string_io = StringIO.new
|
177
|
+
string_io.puts "2"
|
178
|
+
string_io.rewind
|
179
|
+
$stdin = string_io
|
180
|
+
@@ui.select_specific_exam(@@exams)
|
181
|
+
$stdin = STDIN
|
182
|
+
end
|
183
|
+
|
184
|
+
assert_equal 1, result[1].scan("Which one would you like to select").length, "should call select_specific_exam only once if user inputs 2"
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_select_specific_exam_recursion_greater
|
188
|
+
result = OStreamCatcher.catch do
|
189
|
+
string_io = StringIO.new
|
190
|
+
string_io.puts "30"
|
191
|
+
string_io.puts "1"
|
192
|
+
string_io.rewind
|
193
|
+
$stdin = string_io
|
194
|
+
@@ui.select_specific_exam(@@exams)
|
195
|
+
$stdin = STDIN
|
196
|
+
end
|
197
|
+
|
198
|
+
assert_operator result[1].scan("Which one would you like to select").length, :>, 1, "should call select_specific_exam more than once if user inputs number above length of options"
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_select_specific_exam_recursion_0
|
202
|
+
result = OStreamCatcher.catch do
|
203
|
+
string_io = StringIO.new
|
204
|
+
string_io.puts "0"
|
205
|
+
string_io.puts "1"
|
206
|
+
string_io.rewind
|
207
|
+
$stdin = string_io
|
208
|
+
@@ui.select_specific_exam(@@exams)
|
209
|
+
$stdin = STDIN
|
210
|
+
end
|
211
|
+
|
212
|
+
assert_operator result[1].scan("Which one would you like to select").length, :>, 1, "should call select_specific_exam more than once if user inputs 0"
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_provide_scores_returns_exam
|
216
|
+
result = {}
|
217
|
+
|
218
|
+
OStreamCatcher.catch do
|
219
|
+
string_io = StringIO.new
|
220
|
+
|
221
|
+
@@exams[0].sections.each do |section|
|
222
|
+
string_io.puts "70"
|
223
|
+
end
|
224
|
+
|
225
|
+
string_io.rewind
|
226
|
+
$stdin = string_io
|
227
|
+
result = @@ui.provide_scores(@@exams[0])
|
228
|
+
$stdin = STDIN
|
229
|
+
end
|
230
|
+
|
231
|
+
assert_instance_of Exam, result, "should return Exam object after calling provide_scores"
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_provide_scores_prompts_user_for_each_section
|
235
|
+
result = OStreamCatcher.catch do
|
236
|
+
string_io = StringIO.new
|
237
|
+
|
238
|
+
@@exams[0].sections.each do |section|
|
239
|
+
string_io.puts "70"
|
240
|
+
end
|
241
|
+
|
242
|
+
string_io.rewind
|
243
|
+
$stdin = string_io
|
244
|
+
@@ui.provide_scores(@@exams[0])
|
245
|
+
$stdin = STDIN
|
246
|
+
end
|
247
|
+
|
248
|
+
assert_equal @@exams[0].sections.length, result[1].scan("What score did you get").length, "should prompt user for input once for every section of exam parameter when call provide_scores"
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_provide_all_details_manually_returns_exam
|
252
|
+
result = {}
|
253
|
+
|
254
|
+
OStreamCatcher.catch do
|
255
|
+
string_io = StringIO.new
|
256
|
+
string_io.puts "My Test"
|
257
|
+
string_io.puts "4"
|
258
|
+
|
259
|
+
(1..4).each do |i|
|
260
|
+
string_io.puts "Section #{i}"
|
261
|
+
string_io.puts "25"
|
262
|
+
string_io.puts "80"
|
263
|
+
end
|
264
|
+
|
265
|
+
string_io.rewind
|
266
|
+
$stdin = string_io
|
267
|
+
result = @@ui.provide_all_details_manually
|
268
|
+
$stdin = STDIN
|
269
|
+
end
|
270
|
+
|
271
|
+
assert_instance_of Exam, result, "should return Exam object after calling provide_all_details_manually"
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_provide_all_details_manually_prompts_user_2_more_than_3_times_sections
|
275
|
+
sections = 4
|
276
|
+
prompts = 2 + 3 * sections
|
277
|
+
|
278
|
+
result = OStreamCatcher.catch do
|
279
|
+
string_io = StringIO.new
|
280
|
+
string_io.puts "My Test"
|
281
|
+
string_io.puts "#{sections}"
|
282
|
+
|
283
|
+
(1..sections).each do |i|
|
284
|
+
string_io.puts "Section #{i}"
|
285
|
+
string_io.puts "25"
|
286
|
+
string_io.puts "80"
|
287
|
+
end
|
288
|
+
|
289
|
+
string_io.rewind
|
290
|
+
$stdin = string_io
|
291
|
+
@@ui.provide_all_details_manually
|
292
|
+
$stdin = STDIN
|
293
|
+
end
|
294
|
+
|
295
|
+
assert_equal prompts, result[1].scan("\n").length, "should prompt user for input 2 more than 3 times the number of sections entered when call provide_all_details_manually"
|
296
|
+
end
|
297
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: salesforce_certification_calculator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jackson Reeves
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
description: Salesforce resource for certifications
|
28
|
+
email: jr@jacksonreeves.com
|
29
|
+
executables:
|
30
|
+
- salesforce_certification_calculator
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- bin/salesforce_certification_calculator
|
37
|
+
- data/Administrator-Spring2022.xml
|
38
|
+
- data/AdvancedAdministrator-Spring2022.xml
|
39
|
+
- data/B2BSolutionArchitect-Spring2022.xml
|
40
|
+
- data/B2CSolutionArchitect-Spring2022.xml
|
41
|
+
- data/DataArchitect-Spring2022.xml
|
42
|
+
- data/DevelopmentLifecycleAndDeploymentArchitect-Spring2022.xml
|
43
|
+
- data/EducationCloudConsultant-Spring2022.xml
|
44
|
+
- data/ExperienceCloudConsultant-Spring2022.xml
|
45
|
+
- data/IdentityAndAccessManagementArchitect-Spring2022.xml
|
46
|
+
- data/IntegrationArchitect-Spring2022.xml
|
47
|
+
- data/JavaScriptDeveloperI-Spring2022.xml
|
48
|
+
- data/MarketingCloudAdministrator-Spring2022.xml
|
49
|
+
- data/MarketingCloudConsultant-Spring2022.xml
|
50
|
+
- data/MarketingCloudDeveloper-Spring2022.xml
|
51
|
+
- data/MarketingCloudEmailSpecialist-Spring2022.xml
|
52
|
+
- data/PlatformAppBuilder-Spring2022.xml
|
53
|
+
- data/PlatformDeveloperI-Spring2022.xml
|
54
|
+
- data/PlatformDeveloperII-Spring2022.xml
|
55
|
+
- data/SalesCloudConsultant-Spring2022.xml
|
56
|
+
- data/ServiceCloudConsultant-Spring2022.xml
|
57
|
+
- data/SharingAndVisibilityArchitect-Spring2022.xml
|
58
|
+
- lib/salesforce_certification_calculator.rb
|
59
|
+
- lib/salesforce_certification_calculator/exam.rb
|
60
|
+
- lib/salesforce_certification_calculator/file_reader.rb
|
61
|
+
- lib/salesforce_certification_calculator/section.rb
|
62
|
+
- lib/salesforce_certification_calculator/u_i.rb
|
63
|
+
- test/test_exam.rb
|
64
|
+
- test/test_file_reader.rb
|
65
|
+
- test/test_salesforce_certification_calculator.rb
|
66
|
+
- test/test_section.rb
|
67
|
+
- test/test_u_i.rb
|
68
|
+
homepage: https://github.com/jtreeves/salesforce_certification_calculator
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message: Thanks for installing the SalesforceCertificationCalculator
|
73
|
+
module!
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
- data
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubygems_version: 3.3.7
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: Calculates cumulative percentage from Salesforce certification section results
|
93
|
+
test_files:
|
94
|
+
- test/test_exam.rb
|
95
|
+
- test/test_file_reader.rb
|
96
|
+
- test/test_salesforce_certification_calculator.rb
|
97
|
+
- test/test_section.rb
|
98
|
+
- test/test_u_i.rb
|