CSC/ECE 517 Spring 2018- Project E1812: on the fly calc.rb
E1812: Unit tests for on_the_fly_calc.rb
This wiki page gives a description of changes made under Expertiza OSS project E1812 assignment for Spring 2018, CSC/ECE 517.
NOTE to reviewers
Mocks and stubs are used for the unit tests so they can't be tested by UI.
Expertiza Background
Expertiza is an open source web application developed with Ruby on Rails framework. This application allows students to access assignments posted by an instructor, submit their work (articles, codes, websites), review others work submissions. Expertiza gives a chance to improve students’ work based on their peer-reviews, and it can also help in grading students’ submissions based on that feedback. Students can form their teams for an assignment, otherwise, teams can be assigned automatically.
Problem Statement
The task of this assignment is write unit tests for on_the_fly_calc.rb. The on_the_fly_calc.rb module does not have any test cases corresponding to it. Thus, the task of this assignment is write unit tests for on_the_fly_calc.rb using RSpec. The test cases should be fast, effective, and achieve the maximum code coverage.
Created/Modified Files
As a part of the project the file listed below was created and saved under spec/models folder:
- on_the_fly_calc_spec.rb
The file listed below was modified due to some code issues in it.
- on_the_fly_calc.rb (path: app/models)
Thoughts
What we need to do is to write tests for four public methods listed in the module OnTheFLyCalc. However, the on_the_fly_calc itself has some code issues in #scores, and IDE reports some errors when we run the test case for it. Thus, we need to modify the module itself a little.
Testing
Tools
RSpec
For this project we use RSpec which is a testing tool for Ruby, created for behavior-driven development (BDD).