diff --git a/.travis.yml b/.travis.yml index 323eb77..06716d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +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 -# uncomment this line if your project needs to run something other than `rake`: -# script: bundle exec rspec spec + - rbx-2 +gem: + - minitest \ No newline at end of file diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..afa0863 --- /dev/null +++ b/Rakefile @@ -0,0 +1,25 @@ +#!/usr/bin/env rake +require 'minitest' + +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 + +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 do + puts "Starting the math test" + # how do we run the math test here? + require_relative "tests/test_simple_numbers" + +end \ No newline at end of file diff --git a/assignments/hello-world.md b/assignments/hello-world.md new file mode 100644 index 0000000..7b30edc --- /dev/null +++ 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/how-to-write-homework-stories.md b/stories/how-to-write-homework-stories.md new file mode 100644 index 0000000..44c0e0a --- /dev/null +++ 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 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/how-to-write-homework-tests.md b/tests/how-to-write-homework-tests.md new file mode 100644 index 0000000..ba16386 --- /dev/null +++ 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. + 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