ruby代写

In the reference directory is a file called task02Orig.rb. In the spec
directory, there is an rspec test file for testing lib/task02.rb (specifically
the integration tests from the original source that exercise the
VendingMachine class). The file task02Orig.rb passes the tests for this
assignment, but does not pass the code quality checks of rubocop or reek.

For this assignment, you are supposed to create a task02.rb file in the lib
directory that passes the testing (even when different random number seeds
are used — see random testing note below) as well as the quality checks.
You may either start by copying reference/task02Orig.rb into lib/task02.rb
and then refactoring, or you can build a new task02.rb from scratch.

Your solution should recieve no complaints from the rubocop checker
You are not allowed to have the text `rubocop:’ anywhere in your
lib/task02.rb file (as this is a feature of rubocop for turning off some
of the checking).

Furthermore, your solution should recieve no complaints from reek
when run as:
reek -c reek-config.yml lib
to use my version of the reek configuration file. [Initially, reek gave 8
warnings.] Additionally, you are not allowed to have the text `:reek’
anywhere in your lib/task02.rb file (as this is a feature of reek for turning
off some of the checking).

Your task02.rb is not allowed to require any files or libraries other than
bigdecimal, which the original code required.

Nor can task02.rb make any use of the word oracle as this is being used by
the testing oracle code. In general, your code should not be referencing
the testing environment (e.g., no usage of RSpec). Nor should it be doing
any I/O which would interfer with the automated marker processing the
output from the test framework.

As noted in class, reek has trouble processing modules, so neither the
keyword module or the class name Module may appear in lib/task02.rb .
Similarly, the program should not create class variables (no @@) or
class methods, but instead use just instance variables and instance
methods like the original.

See the quickCheck script in this directory to catch the various disallowed
text.

As usual, your lib/task02.rb file must be self-contained as it will be copied
out of your git repository into a separate test framework.

Random testing note: since we have a given implementation, I can use it as
a test oracle for checking to see if your version of task02.rb behaves
identically to the original task02.rb . To do this I am setting a seed on
a random number generator. For marking, the same setup will be used, but
a different seed.

Note: we are running with the default rubocop yml file, which can be
found at:
https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
Initially
rubocop lib
found 72 warnings.

As usual, there is a three minute time limit on how long your assignment
takes to be evaluated on the course compute server. Note this assignment
does not involve either mutation testing or simplecov, although you may
find it useful to evaluate whether or not your solution has been adequately
tested.

Your solution is the lib/task02.rb file. While you can change the other
files in this directory, when I update the repository, your changes will
get overwritten. So, if you want to add extra tests, it is best to do it
in files other than the ones included here.