mirror of
https://github.com/SpacehuhnTech/esp8266_deauther.git
synced 2025-12-11 17:19:58 +01:00
Check changes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'sinclair'
|
||||
|
||||
class FontHelper
|
||||
autoload :Font, 'font_helper/font'
|
||||
autoload :Character, 'font_helper/character'
|
||||
|
||||
@@ -4,7 +4,7 @@ class FontHelper
|
||||
class Character
|
||||
attr_reader :code
|
||||
|
||||
def initialize(code)
|
||||
def initialize(code:)
|
||||
@code = code
|
||||
end
|
||||
|
||||
|
||||
@@ -25,5 +25,9 @@ class FontHelper
|
||||
def quantity
|
||||
characters.size
|
||||
end
|
||||
|
||||
def character(code)
|
||||
characters[code]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe FontHelper::Character do
|
||||
subject(:character) { described_class.new(code) }
|
||||
subject(:character) { described_class.new(code:) }
|
||||
|
||||
describe '#character' do
|
||||
context 'when code is a valid character' do
|
||||
|
||||
@@ -29,6 +29,12 @@ describe FontHelper::Font do
|
||||
.to change(font, :quantity)
|
||||
.from(1).to(2)
|
||||
end
|
||||
|
||||
it do
|
||||
expect { font << character }
|
||||
.to change(font, :quantity)
|
||||
.from(1).to(2)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is already the same character' do
|
||||
@@ -38,6 +44,11 @@ describe FontHelper::Font do
|
||||
expect { font << character }
|
||||
.not_to change(font, :quantity)
|
||||
end
|
||||
|
||||
it do
|
||||
expect { font << character }
|
||||
.to change { font.character(character.code) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
FactoryBot.define do
|
||||
factory :character, class: FontHelper::Character do
|
||||
initialize_with do
|
||||
FontHelper::Character.new(code)
|
||||
FontHelper::Character.new(code:)
|
||||
end
|
||||
|
||||
transient do
|
||||
|
||||
Reference in New Issue
Block a user