diff --git a/Assignments/Lesson01-Assignment01-Case-Statement/README.html b/Assignments/Lesson01-Assignment01-Case-Statement/README.html index 728a4f1..e2cccbd 100644 --- a/Assignments/Lesson01-Assignment01-Case-Statement/README.html +++ b/Assignments/Lesson01-Assignment01-Case-Statement/README.html @@ -63,18 +63,19 @@

Getting Started

  $ rspec
 
-.FFF
+.FFFF
 
 Failures:
 ...
 Finished in 0.02247 seconds (files took 0.1567 seconds to load)
-4 examples, 3 failures
+5 examples, 4 failures
 
 Failed examples:
 
-rspec ./spec/case_spec.rb:17 # lesson1 check implementation remove if clause
-rspec ./spec/case_spec.rb:21 # lesson1 check implementation remove elsif clause
-rspec ./spec/case_spec.rb:25 # lesson1 check implementation missing case
+rspec ./spec/lesson1_spec.rb:17 # lesson1 check implementation remove if clause +rspec ./spec/lesson1_spec.rb:21 # lesson1 check implementation remove elsif clause +rspec ./spec/lesson1_spec.rb:25 # lesson1 check implementation remove elsif clause +rspec ./spec/lesson1_spec.rb:29 # lesson1 check implementation missing case
  1. Implement the solution and re-test.
@@ -90,6 +91,6 @@

Self Grading/Feedback

$ rspec
 
 Finished in 0.00304 seconds (files took 0.16353 seconds to load)
-4 examples, 0 failures
+5 examples, 0 failures

Submission

There is no submission required for this assignment but the skills learned will be part of a follow-on assignment so please complete this to the requirements of the unit test.

diff --git a/Assignments/Lesson01-Assignment01-Case-Statement/README.md b/Assignments/Lesson01-Assignment01-Case-Statement/README.md index 7f72bf4..33cc262 100644 --- a/Assignments/Lesson01-Assignment01-Case-Statement/README.md +++ b/Assignments/Lesson01-Assignment01-Case-Statement/README.md @@ -89,18 +89,19 @@ solution. ```shell $ rspec -.FFF +.FFFF Failures: ... Finished in 0.02247 seconds (files took 0.1567 seconds to load) -4 examples, 3 failures +5 examples, 4 failures Failed examples: -rspec ./spec/case_spec.rb:17 # lesson1 check implementation remove if clause -rspec ./spec/case_spec.rb:21 # lesson1 check implementation remove elsif clause -rspec ./spec/case_spec.rb:25 # lesson1 check implementation missing case +rspec ./spec/lesson1_spec.rb:17 # lesson1 check implementation remove if clause +rspec ./spec/lesson1_spec.rb:21 # lesson1 check implementation remove elsif clause +rspec ./spec/lesson1_spec.rb:25 # lesson1 check implementation remove elsif clause +rspec ./spec/lesson1_spec.rb:29 # lesson1 check implementation missing case ``` 5. Implement the solution and re-test. @@ -127,7 +128,7 @@ as your solution. $ rspec Finished in 0.00304 seconds (files took 0.16353 seconds to load) -4 examples, 0 failures +5 examples, 0 failures ``` ### Submission diff --git a/Assignments/Lesson01-Assignment01-Case-Statement/student-start/module2_lesson1_formative.rb b/Assignments/Lesson01-Assignment01-Case-Statement/student-start/module2_lesson1_formative.rb index 25795f2..5e253c9 100644 --- a/Assignments/Lesson01-Assignment01-Case-Statement/student-start/module2_lesson1_formative.rb +++ b/Assignments/Lesson01-Assignment01-Case-Statement/student-start/module2_lesson1_formative.rb @@ -12,4 +12,4 @@ else puts "I guess nothing matched... But why?" -end \ No newline at end of file +end diff --git a/Assignments/Lesson01-Assignment01-Case-Statement/student-start/spec/lesson1_spec.rb b/Assignments/Lesson01-Assignment01-Case-Statement/student-start/spec/lesson1_spec.rb index b61525b..772c601 100644 --- a/Assignments/Lesson01-Assignment01-Case-Statement/student-start/spec/lesson1_spec.rb +++ b/Assignments/Lesson01-Assignment01-Case-Statement/student-start/spec/lesson1_spec.rb @@ -22,8 +22,8 @@ expect(srcCode).not_to include("elsif") end - it "remove elsif clause" do - expect(srcCode).not_to include("elsif") + it "keep else clause" do + expect(srcCode).to include("else") end it "missing case" do diff --git a/Assignments/Lesson02-Assignment01-Collections/student-start/spec/lesson2_spec.rb b/Assignments/Lesson02-Assignment01-Collections/student-start/spec/lesson2_spec.rb index c7d00f9..12dbc74 100644 --- a/Assignments/Lesson02-Assignment01-Collections/student-start/spec/lesson2_spec.rb +++ b/Assignments/Lesson02-Assignment01-Collections/student-start/spec/lesson2_spec.rb @@ -3,59 +3,55 @@ describe "lesson2" do - context "check results" do - result=`ruby module2_lesson2_formative.rb` - lines=result.split("\n") - numbers=[] - #process the last line of output - values=lines[lines.count-1].split(",").each { |v| - number=/([0-9]+)/.match(v).to_s.to_i + context "output array" do + result = `ruby module2_lesson2_formative.rb` + lines = result.split("\n") + numbers = [] + + # process the last line of output + values = lines[lines.count-1].split(",").each { |v| + number = /([0-9]+)/.match(v).to_s.to_i numbers << number } - it "unexpected number of output lines" do + it "is expected to contain 3 lines" do expect(lines.size).to be == 3 end - it "unexpected minimum number" do + it "should not contain any number under 5000" do numbers.each { |n| expect(n).to be >= 5000 } end - it "not modulo 3" do - numbers.each { |n| - expect(n % 3).to be == 0 - } + it "is expected to be sorted in descending order" do + expect(numbers).to eq numbers.sort.reverse end - - it "unexpected sort order" do - lowest=nil - numbers.each { |n| - expect(n).to be <= lowest if !lowest.nil? - lowest=n - } + + it "should not contain numbers not divisible by 3" do + numbers.each do |n| + expect(n % 3).to be == 0 + end end end - #probably should strip out commented lines before doing this - context "check implementation" do - srcCode = File.open("module2_lesson2_formative.rb", "r").read + context "implementation" do + src_code = File.open("module2_lesson2_formative.rb", "r").read - it "missing select" do - expect(srcCode).to include("select") + it "should contain select" do + expect(src_code).to include("select") end - it "missing reject" do - expect(srcCode).to include("reject") + it "should contain reject" do + expect(src_code).to include("reject") end - it "missing sort" do - expect(srcCode).to include("sort") + it "should contain sort" do + expect(src_code).to include("sort") end - it "missing reverse" do - expect(srcCode).to include("reverse") + it "should contain reverse" do + expect(src_code).to include("reverse") end end end diff --git a/Assignments/Lesson03-Assignment01-Classes/student-start/spec/lesson3_spec.rb b/Assignments/Lesson03-Assignment01-Classes/student-start/spec/lesson3_spec.rb index 9aa0484..8b3eaaf 100644 --- a/Assignments/Lesson03-Assignment01-Classes/student-start/spec/lesson3_spec.rb +++ b/Assignments/Lesson03-Assignment01-Classes/student-start/spec/lesson3_spec.rb @@ -4,6 +4,8 @@ describe "lesson3" do + subject { Person } + context "check results" do p1 = Person.new("Ivana", "Trump") p2 = Person.new("Eric", "Trump") @@ -29,7 +31,6 @@ end context "check class properties" do - subject(:class) { Person } it "missing search" do is_expected.to respond_to(:search)