Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions assignments/hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# File: simple-numbers.rb

# Tests:
26 changes: 26 additions & 0 deletions assignments/simple_numbers.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions stories/documentation.md
Original file line number Diff line number Diff line change
@@ -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.
16 changes: 16 additions & 0 deletions stories/how-to-write-homework-stories.md
Original file line number Diff line number Diff line change
@@ -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 <type of user>, I want <some goal> so that <some reason>.```

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"
11 changes: 11 additions & 0 deletions stories/math.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions tests/how-to-write-homework-tests.md
Original file line number Diff line number Diff line change
@@ -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.

39 changes: 39 additions & 0 deletions tests/test_simple_numbers.rb
Original file line number Diff line number Diff line change
@@ -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