Created
September 10, 2021 19:02
-
-
Save henrymazza/499e5ed2cd9d0bcdf77bbf981b2b1ad7 to your computer and use it in GitHub Desktop.
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
# frozen_string_literal: true | |
require 'hello' | |
RSpec.describe Hello do | |
describe '.world' do | |
subject(:world) do | |
described_class.world | |
end | |
it { is_expected.to eq 'helloworld' } | |
end | |
describe '.rand_list' do | |
subject(:rand_list) { described_class.method(:rand_list) } | |
it 'returns a list of length' do | |
expect(rand_list.call(3, 2, 9).length).to be 3 | |
end | |
it 'returns a list with lower bound' do | |
expect(rand_list.call(3, 2, 9).min).to be >= 2 | |
end | |
it 'returns a list with upper bound' do | |
expect(rand_list.call(3, 2, 9).max).to be <= 9 | |
end | |
end | |
describe '.capscrumble' do | |
subject(:capscrumble) { described_class.method(:capscrumble) } | |
it "finds all possible cases 'ab'" do | |
expect(capscrumble.call('ab')).to match_array(%w[ab Ab aB AB]) | |
end | |
it "finds all possible cases for 'BC'" do | |
expect(capscrumble.call('BC')).to match_array(%w[bc Bc bC BC]) | |
end | |
it 'returns a list the size of square of input length' do | |
expect(capscrumble.call('ABCD').length).to be 16 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment