From 540a7d123db4e1750232cfd9d837d41ee22f4b7d Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 14:25:58 +0000 Subject: [PATCH 01/16] add tests and stories howtows --- stories/how-to-write-homework-stories.md | 0 tests/how-to-write-homework-tests.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 stories/how-to-write-homework-stories.md create mode 100644 tests/how-to-write-homework-tests.md diff --git a/stories/how-to-write-homework-stories.md b/stories/how-to-write-homework-stories.md new file mode 100644 index 0000000..e69de29 diff --git a/tests/how-to-write-homework-tests.md b/tests/how-to-write-homework-tests.md new file mode 100644 index 0000000..e69de29 From be11bc43a9c63031b3e13cd1fd7ec027a1589abf Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 15:13:54 +0000 Subject: [PATCH 02/16] add definition of user stories to how to write homweork stories documentation --- stories/how-to-write-homework-stories.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stories/how-to-write-homework-stories.md b/stories/how-to-write-homework-stories.md index e69de29..44c0e0a 100644 --- a/stories/how-to-write-homework-stories.md +++ b/stories/how-to-write-homework-stories.md @@ -0,0 +1,16 @@ +### Stories are ideas. + +When you're writing a story remember that it will need to be understandable by both the students, the teacher and the developer writing the test. + +We use an adoptation of traditional [Agile user stories][1] that stories should be short, from your own perspective, easy to read and understand. Most importantly to learning coding, stories should explain the value of learning a particular concept. + +Commonly, user stories follow the format below: + +```As a , I want so that .``` + +A realistic example: + +```As a beginner ruby programmer I want to write syntaxtually correct Ruby code so that I can learn how be a good developer.``` + +### External Resources +[1]: http://www.mountaingoatsoftware.com/agile/user-stories "Agile user stories" \ No newline at end of file From aa6b1fa584855c6ec0e846328201b934ace4be4e Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 15:22:02 +0000 Subject: [PATCH 03/16] add some documentation to the how to write tests documentation --- tests/how-to-write-homework-tests.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/how-to-write-homework-tests.md b/tests/how-to-write-homework-tests.md index e69de29..ba16386 100644 --- a/tests/how-to-write-homework-tests.md +++ b/tests/how-to-write-homework-tests.md @@ -0,0 +1,8 @@ +### Tests shouldn't be hard + +Tests should be written to determine if a particular set of stories have been satisfied. Tests are used to prove if a student has correctly coded an element of an assignment. As students progress, their assignments will be exposed to more tests. + +### Assigning tests to stories + +Test documentation should be correctly associated with a test. Remember that the tests can be run locally by students and by teachers to grade assignments. + From 612a8e13d99bca9c0b4b2e64252aa5fbb2081939 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 15:23:02 +0000 Subject: [PATCH 04/16] add the first assignment, hello world --- assignments/hello-world.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assignments/hello-world.md diff --git a/assignments/hello-world.md b/assignments/hello-world.md new file mode 100644 index 0000000..e69de29 From 28654985b50871bd883440d72846a508646ee409 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:17:09 +0000 Subject: [PATCH 05/16] add math stories, tests and simple math class --- .travis.yml | 1 + assignments/hello-world.md | 3 +++ assignments/simple_numbers.rb | 26 +++++++++++++++++++++++ stories/documentation.md | 11 ++++++++++ stories/math.md | 11 ++++++++++ tests/test_simple_numbers.rb | 39 +++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+) create mode 100644 assignments/simple_numbers.rb create mode 100644 stories/documentation.md create mode 100644 stories/math.md create mode 100644 tests/test_simple_numbers.rb diff --git a/.travis.yml b/.travis.yml index 323eb77..8f184ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,3 +8,4 @@ rvm: - rbx # uncomment this line if your project needs to run something other than `rake`: # script: bundle exec rspec spec +script: ruby tests/test_simple_numbers.rb diff --git a/assignments/hello-world.md b/assignments/hello-world.md index e69de29..7b30edc 100644 --- a/assignments/hello-world.md +++ b/assignments/hello-world.md @@ -0,0 +1,3 @@ +# File: simple-numbers.rb + +# Tests: \ No newline at end of file diff --git a/assignments/simple_numbers.rb b/assignments/simple_numbers.rb new file mode 100644 index 0000000..788c51f --- /dev/null +++ b/assignments/simple_numbers.rb @@ -0,0 +1,26 @@ +# File: simple_numbers.rb + +class SimpleNumbers + def initialize(num) + raise unless num.is_a?(Numeric) + @x = num + end + + def add(y) + @x + y + end + + def subtract(y) + @x - y + end + + def multiply(y) + @x * y + end + + def divide(y) + # check that divisor is not zero + raise unless y != 0 + @x / y + end +end diff --git a/stories/documentation.md b/stories/documentation.md new file mode 100644 index 0000000..f9ce67c --- /dev/null +++ b/stories/documentation.md @@ -0,0 +1,11 @@ +#Documentation + +Documentation is an important part of writing software. Learning how to properly read and write documentation is almost as important as being able to write the actual programming language. + +### RDOC tests + +1 As a student I know how to create a comment so that I can make explain my code properly + +2 As a beginner programmer I know how to read RDOC comments to identify the return value of a method so I can understand what a method will return. + +3 As a beginner programmer I know how to read RDOC comments to identify the input value of a method so I can understand what parameters a method expects. \ No newline at end of file diff --git a/stories/math.md b/stories/math.md new file mode 100644 index 0000000..a64f33b --- /dev/null +++ b/stories/math.md @@ -0,0 +1,11 @@ +# These are the math stories + + +### Basic math +MATH1 As a beginner programmer I should be able to add numbers together so that I understand how ruby can be used to add numbers. + +MATH2 As a beginner programmer I should be able to subtract numbers so that I understand how ruby can be used to subtract numbers. + +MATH3 As a beginner programmer I should be able to multiply numbers so that I understand how ruby can be used to multiply numbers. + +MATH4 As a beginner programmer I should be able to divide numbers so that I understand how ruby can be used to multiply numbers. \ No newline at end of file diff --git a/tests/test_simple_numbers.rb b/tests/test_simple_numbers.rb new file mode 100644 index 0000000..a595ab5 --- /dev/null +++ b/tests/test_simple_numbers.rb @@ -0,0 +1,39 @@ +# File: tc_simple_numbers.rb + +# The tests for simple_numbers + +require_relative "../assignments/simple_numbers" +require "minitest/autorun" + +class TestSimpleNumbers < Minitest::Test + + # Tests the add method of the SimpleNumbers class + # related to story MATH1 + def test_add + assert_equal( 4, SimpleNumbers.new(2).add(2) ) + assert_equal( 10, SimpleNumbers.new(5).add(5) ) + assert_equal( 0, SimpleNumbers.new(0).add(0) ) + end + + # Tests the subtract method of the SimpleNumbers class + # related to story MATH2 + def test_subtract + assert_equal( 4, SimpleNumbers.new(10).subtract(6) ) + assert_equal( 0, SimpleNumbers.new(5).subtract(5) ) + end + + # Tests the multiply method of the SimpleNumbers class + # related to story MATH3 + def test_multiply + assert_equal( 25, SimpleNumbers.new(5).multiply(5) ) + assert_equal( 10, SimpleNumbers.new(2).multiply(5) ) + assert_equal( 0, SimpleNumbers.new(10).multiply(0) ) + end + + # Tests the divide method of the SimpleNumbers class + # related to story MATH4 + def test_divide + assert_equal( 5, SimpleNumbers.new(25).divide(5) ) + assert_equal( 2, SimpleNumbers.new(6).divide(3) ) + end +end From 8968286e2f34db2c1d80d43ad13829444f47b7b2 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:20:28 +0000 Subject: [PATCH 06/16] remove old versions of ruby and only require 2.1.4 --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f184ca..8bd269f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,12 @@ language: ruby rvm: - - "1.8.7" - - "1.9.2" - - "1.9.3" - - jruby-18mode # JRuby in 1.8 mode - - jruby-19mode # JRuby in 1.9 mode - - rbx +# - "1.8.7" +# - "1.9.2" +# - "1.9.3" +# - jruby-18mode # JRuby in 1.8 mode +# - jruby-19mode # JRuby in 1.9 mode +# - rbx + - "2.1.4" # uncomment this line if your project needs to run something other than `rake`: # script: bundle exec rspec spec script: ruby tests/test_simple_numbers.rb From db2435579d01359362b4accd89075f7cae82989f Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:27:33 +0000 Subject: [PATCH 07/16] test only against jruby-master --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8bd269f..a565316 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ rvm: # - jruby-18mode # JRuby in 1.8 mode # - jruby-19mode # JRuby in 1.9 mode # - rbx - - "2.1.4" +# - "2.1.4" + - jruby-master # uncomment this line if your project needs to run something other than `rake`: # script: bundle exec rspec spec script: ruby tests/test_simple_numbers.rb From 74ad32744ddb2bbf9e94dc4579e4f89091c336aa Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:38:36 +0000 Subject: [PATCH 08/16] try to run bundle install first --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a565316..07ba4d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ rvm: # - jruby-18mode # JRuby in 1.8 mode # - jruby-19mode # JRuby in 1.9 mode # - rbx -# - "2.1.4" - - jruby-master + - "2.1.0" +# - jruby-master # uncomment this line if your project needs to run something other than `rake`: -# script: bundle exec rspec spec +script: bundle exec install script: ruby tests/test_simple_numbers.rb From 2001e0e084b3f09853c976a4cdee0dac29a37254 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:48:59 +0000 Subject: [PATCH 09/16] try rbx-2 without running our tests --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07ba4d4..9a50a5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,5 @@ rvm: - "2.1.0" # - jruby-master # uncomment this line if your project needs to run something other than `rake`: -script: bundle exec install -script: ruby tests/test_simple_numbers.rb +# script: bundle exec install +# script: ruby tests/test_simple_numbers.rb From 1b90d75430cb800e5054fd9e68496110501b2b6e Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:54:09 +0000 Subject: [PATCH 10/16] add Rakefile --- .travis.yml | 8 +++++++- Rakefile | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 Rakefile diff --git a/.travis.yml b/.travis.yml index 9a50a5f..6ab235c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,14 @@ rvm: # - jruby-18mode # JRuby in 1.8 mode # - jruby-19mode # JRuby in 1.9 mode # - rbx - - "2.1.0" + - rbx-2 # - jruby-master # uncomment this line if your project needs to run something other than `rake`: # script: bundle exec install # script: ruby tests/test_simple_numbers.rb + +# I added this while trying to get minitest to run +# Thanks : +platforms :rbx do + gem 'minitest' +end diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..8d2630f --- /dev/null +++ b/Rakefile @@ -0,0 +1 @@ +# this Rakefile doesn't really do anything yet \ No newline at end of file From 5600be1e2cc1fdc43e562af69ea851dbd37777a1 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 16:56:59 +0000 Subject: [PATCH 11/16] remove the rbx gem 'minitest' bit from travis --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ab235c..67ae229 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,6 @@ rvm: # I added this while trying to get minitest to run # Thanks : -platforms :rbx do - gem 'minitest' -end +# platforms rbx do +# gem 'minitest' +# end From d7ada6d6104f22f9cb83a3062a48e327c99818a0 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 17:05:41 +0000 Subject: [PATCH 12/16] add a default task to the Rakefile --- Rakefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 8d2630f..81c6189 100644 --- a/Rakefile +++ b/Rakefile @@ -1 +1,9 @@ -# this Rakefile doesn't really do anything yet \ No newline at end of file +# this Rakefile doesn't really do anything yet + +task :default do + puts "The default task should actually do something" +end + +task :math_test do + puts "Starting math tests" +end \ No newline at end of file From aa4b3dfeb66a61c477069df110d78474147534d8 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 17:35:54 +0000 Subject: [PATCH 13/16] The rakefile is doing all the tests --- Rakefile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Rakefile b/Rakefile index 81c6189..f8a5e0a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,22 @@ -# this Rakefile doesn't really do anything yet +#!/usr/bin/env rake +require 'minitest' -task :default do - puts "The default task should actually do something" +task :default => 'test' + +task :test do + puts "Starting the test now" + Rake::Task[:lint].execute + Rake::Task[:math].execute +end + +task :lint do + puts "Starting the linting test" + # Save this for later once there is a lint test + # how do we run a test suite here end -task :math_test do - puts "Starting math tests" +task :math do + puts "Starting the math test" + # how do we run the math test here? + Dir.glob('./tests/test_*.rb').each{ |file| require file} end \ No newline at end of file From f4b3c056df5dbeb453758414a0497acf27f2c1f7 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 18:15:40 +0000 Subject: [PATCH 14/16] try to run each test individually --- Rakefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f8a5e0a..afa0863 100644 --- a/Rakefile +++ b/Rakefile @@ -5,6 +5,8 @@ task :default => 'test' task :test do puts "Starting the test now" + # Dir.glob('./tests/test_*.rb').each{ |file| require file} + Rake::Task[:lint].execute Rake::Task[:math].execute end @@ -18,5 +20,6 @@ end task :math do puts "Starting the math test" # how do we run the math test here? - Dir.glob('./tests/test_*.rb').each{ |file| require file} + require_relative "tests/test_simple_numbers" + end \ No newline at end of file From ff62b4fb2e4c341452e5f69f6f288e21e73013f1 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 18:25:32 +0000 Subject: [PATCH 15/16] try to do the gem install before running the test --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67ae229..fc5b63e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,10 @@ rvm: - rbx-2 # - jruby-master # uncomment this line if your project needs to run something other than `rake`: +script: gem install minitest # script: bundle exec install -# script: ruby tests/test_simple_numbers.rb +script: ruby tests/test_simple_numbers.rb + # I added this while trying to get minitest to run # Thanks : From df50e38aaf6eed49675378b21ad15a0bc2455704 Mon Sep 17 00:00:00 2001 From: Russell Fair Date: Thu, 18 Dec 2014 18:30:14 +0000 Subject: [PATCH 16/16] see about uptting the gem directly in the travis file --- .travis.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5b63e..06716d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,5 @@ language: ruby rvm: -# - "1.8.7" -# - "1.9.2" -# - "1.9.3" -# - jruby-18mode # JRuby in 1.8 mode -# - jruby-19mode # JRuby in 1.9 mode -# - rbx - rbx-2 -# - jruby-master -# uncomment this line if your project needs to run something other than `rake`: -script: gem install minitest -# script: bundle exec install -script: ruby tests/test_simple_numbers.rb - - -# I added this while trying to get minitest to run -# Thanks : -# platforms rbx do -# gem 'minitest' -# end +gem: + - minitest \ No newline at end of file