salesforce_certification_calculator 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/salesforce_certification_calculator/u_i.rb +3 -3
- data/lib/salesforce_certification_calculator.rb +9 -5
- data/test/test_salesforce_certification_calculator.rb +22 -0
- data/test/test_u_i.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b029eea93b1b6f56977e85781962c822e0bee773d870460bf1c836a7dca92ec
|
4
|
+
data.tar.gz: fb84076ace1358dfc93df233953938db8f9b86d42c8ac4fec6ef3c287a89251c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 427d35fadd423b18a3a3037cd6d10c9ea6ff6a869aec934b1767c6a2d256ea5a3226d9831b97538e2582db4a0ad65d26fba46d7e73a12b7aba80394edcd98689
|
7
|
+
data.tar.gz: 5aadbee6d26c7600831e6d81781d1ec764610708b251b7451a584d73116d82bd382b87ca9cde8be554c4ea60a8a52714d5c90e6156aa092132ed2a0aadd813a9
|
data/README.md
CHANGED
@@ -66,11 +66,11 @@ If you have trouble downloading the package or just want to play around with the
|
|
66
66
|
1. Fork this repository
|
67
67
|
2. Clone it to your local computer
|
68
68
|
3. From within your local version of the directory, build the module: `gem build salesforce_certification_calculator.gemspec`
|
69
|
-
4. Then install that built module: `gem install ./salesforce_certification_calculator-0.2.
|
69
|
+
4. Then install that built module: `gem install ./salesforce_certification_calculator-0.2.6.gem`
|
70
70
|
5. Open a Ruby environment to use the module: `irb`
|
71
71
|
6. Execute any of the recently installed methods
|
72
72
|
|
73
|
-
You may need to update the specific version of the build as later releases come out (e.g., `-0.2.
|
73
|
+
You may need to update the specific version of the build as later releases come out (e.g., `-0.2.6.gem` may need to become `-0.3.0.gem`).
|
74
74
|
|
75
75
|
## Usage
|
76
76
|
|
@@ -134,7 +134,7 @@ end
|
|
134
134
|
|
135
135
|
## Testing
|
136
136
|
|
137
|
-
This project has
|
137
|
+
This project has 107 automated tests, located in the `test` folder at the root. To run them, execute `rake test`. In order to successfully run these tests, you may need to also install `stringio` and `o_stream_catcher`.
|
138
138
|
|
139
139
|
## Future Goals
|
140
140
|
|
data/Rakefile
CHANGED
@@ -43,7 +43,7 @@ class SalesforceCertificationCalculator::UI
|
|
43
43
|
puts "#{exams.find_index(exam) + 1} - #{exam.title}"
|
44
44
|
end
|
45
45
|
|
46
|
-
# Add option to
|
46
|
+
# Add option to let user enter details manually if exam not listed
|
47
47
|
puts "#{exams_length + 1} - NOT LISTED"
|
48
48
|
puts "Which one would you like to select? Enter the number before the exam name:"
|
49
49
|
choice = gets.chomp.to_i
|
@@ -52,8 +52,8 @@ class SalesforceCertificationCalculator::UI
|
|
52
52
|
# Only return value if user inputted number within range
|
53
53
|
return exams[choice - 1]
|
54
54
|
elsif choice == exams_length + 1
|
55
|
-
#
|
56
|
-
|
55
|
+
# Enter details manually if exam not included in list
|
56
|
+
provide_all_details_manually()
|
57
57
|
else
|
58
58
|
# Recursively recall function if invalid input
|
59
59
|
select_specific_exam(exams)
|
@@ -69,12 +69,16 @@ class SalesforceCertificationCalculator
|
|
69
69
|
# Get list of exams, prompt user to select one, then require user to provide their scores for all the exam's sections
|
70
70
|
@exams = @reader.generate_exams_list
|
71
71
|
@exam = @ui.select_specific_exam(@exams)
|
72
|
-
@exam = @reader.extract_initial_exam_data(@exam)
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
# Only proceed if user did not end up entering data manually after not finding their exam listed
|
74
|
+
if @exam.sections.length == 0
|
75
|
+
@exam = @reader.extract_initial_exam_data(@exam)
|
76
|
+
|
77
|
+
puts "You selected: #{@exam.title}"
|
78
|
+
puts "Enter your scores for each of the exam's #{@exam.sections.length} sections in the order you are prompted"
|
79
|
+
|
80
|
+
@exam = @ui.provide_scores(@exam)
|
81
|
+
end
|
78
82
|
else
|
79
83
|
# Allow user to manually enter all data themselves without the aid of the data already stored in the module's XML files
|
80
84
|
@exam = @ui.provide_all_details_manually
|
@@ -186,4 +186,26 @@ class SalesforceTest < Minitest::Test
|
|
186
186
|
|
187
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
188
|
end
|
189
|
+
|
190
|
+
def test_determine_percentage_manually_handles_not_listed_option
|
191
|
+
calculator = SFC.new
|
192
|
+
calculator.generate_exams_list
|
193
|
+
|
194
|
+
result = OStreamCatcher.catch do
|
195
|
+
string_io = StringIO.new
|
196
|
+
string_io.puts "LIST"
|
197
|
+
string_io.puts "#{calculator.exams.length + 1}"
|
198
|
+
string_io.puts "My Test"
|
199
|
+
string_io.puts "1"
|
200
|
+
string_io.puts "Section 1"
|
201
|
+
string_io.puts "100"
|
202
|
+
string_io.puts "70"
|
203
|
+
string_io.rewind
|
204
|
+
$stdin = string_io
|
205
|
+
result = calculator.determine_percentage_manually
|
206
|
+
$stdin = STDIN
|
207
|
+
end
|
208
|
+
|
209
|
+
assert_equal 1, result[1].scan("What is the title of this exam?").length, "should prompt user for title of new test if user selects NOT LISTED after initially selecting LIST"
|
210
|
+
end
|
189
211
|
end
|
data/test/test_u_i.rb
CHANGED
@@ -184,18 +184,26 @@ class UITest < Minitest::Test
|
|
184
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
185
|
end
|
186
186
|
|
187
|
-
def
|
187
|
+
def test_select_specific_exam_call_provide_manually
|
188
188
|
result = OStreamCatcher.catch do
|
189
189
|
string_io = StringIO.new
|
190
190
|
string_io.puts "#{@@exams.length + 1}"
|
191
|
-
string_io.puts "
|
191
|
+
string_io.puts "My Test"
|
192
|
+
string_io.puts "4"
|
193
|
+
|
194
|
+
(1..4).each do |i|
|
195
|
+
string_io.puts "Section #{i}"
|
196
|
+
string_io.puts "25"
|
197
|
+
string_io.puts "80"
|
198
|
+
end
|
199
|
+
|
192
200
|
string_io.rewind
|
193
201
|
$stdin = string_io
|
194
202
|
@@ui.select_specific_exam(@@exams)
|
195
203
|
$stdin = STDIN
|
196
204
|
end
|
197
205
|
|
198
|
-
assert_equal 1, result[1].scan("
|
206
|
+
assert_equal 1, result[1].scan("What is the title of this exam?").length, "should call provide_all_details_manually if user enters NOT LISTED option"
|
199
207
|
end
|
200
208
|
|
201
209
|
def test_select_specific_exam_recursion_greater
|