Sign inSign up

techio/ruby-bundler-runner

By techio

Updated about 9 years ago

Image
0

493

techio/ruby-bundler-runner repository overview

ruby-bundler-runner

How to Use

In order to use this runner for your project, edit the techio.yml file and add the following lines to your project:

runner: techio/ruby-bundler-runner:1.1.0-ruby-2.4

Example

In this example, the student is asked to write a method to keep score for a bowling game hit() (file lib/bowling.rb):

class Bowling
	attr_reader :score
	def hit(pin_count)
    #Write code here
	end
end

In order to test the answer, the following unit test is created (file spec/bowling_spec.rb):

require 'bowling'
RSpec.describe Bowling, "#score" do
	context "with no strikes or spares" do
		it "sums the pin count" do
			bowling = Bowling.new
			20.times { bowling.hit(4) }
			expect(bowling.score).to eq 80
		end
	end
end

We include rspec, the popular unit testing tool by adding the dependency in a Gemfile at the project root as specified in the official documentation:

source 'https://rubygems.org'
gem 'rspec', '~> 3.0'

In the lesson, the unit test can be called using:

@[Test unittest: bowling]({"stubs":["lib/bowling.rb"], "command":"bundle exec bin/rspec --format doc -I lib/ spec/bowling_spec.rb"})

Tag summary

Content type

Image

Digest

Size

258.7 MB

Last updated

about 9 years ago

docker pull techio/ruby-bundler-runner