This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rspec" | |
def combinations(array, length) | |
if length.zero? | |
[[]] | |
else | |
array.each_index.map { |i| array.drop(i) }.flat_map do |head, *tail| | |
combinations(tail, length - 1).map do |combination| | |
[head] + combination | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://www.nhs.uk/NHSEngland/Healthcosts/Pages/Prescriptioncosts.aspx | |
Given a user who is 60 or older | |
When they collect a prescription | |
Then it should be free | |
Given a user who is younger than 16 | |
When they collect a prescription | |
Then it should be free |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ScoreHelpers | |
def self.extended(base) | |
base.class_eval do | |
let(:scores) { {} } | |
end | |
end | |
def the_letter(letter, options) | |
score = options[:is_worth] |