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
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'sinclair'
|
||||||
|
|
||||||
class FontHelper
|
class FontHelper
|
||||||
autoload :Font, 'font_helper/font'
|
autoload :Font, 'font_helper/font'
|
||||||
autoload :Character, 'font_helper/character'
|
autoload :Character, 'font_helper/character'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class FontHelper
|
|||||||
class Character
|
class Character
|
||||||
attr_reader :code
|
attr_reader :code
|
||||||
|
|
||||||
def initialize(code)
|
def initialize(code:)
|
||||||
@code = code
|
@code = code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -25,5 +25,9 @@ class FontHelper
|
|||||||
def quantity
|
def quantity
|
||||||
characters.size
|
characters.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def character(code)
|
||||||
|
characters[code]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe FontHelper::Character do
|
describe FontHelper::Character do
|
||||||
subject(:character) { described_class.new(code) }
|
subject(:character) { described_class.new(code:) }
|
||||||
|
|
||||||
describe '#character' do
|
describe '#character' do
|
||||||
context 'when code is a valid character' do
|
context 'when code is a valid character' do
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ describe FontHelper::Font do
|
|||||||
.to change(font, :quantity)
|
.to change(font, :quantity)
|
||||||
.from(1).to(2)
|
.from(1).to(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect { font << character }
|
||||||
|
.to change(font, :quantity)
|
||||||
|
.from(1).to(2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when there is already the same character' do
|
context 'when there is already the same character' do
|
||||||
@@ -38,6 +44,11 @@ describe FontHelper::Font do
|
|||||||
expect { font << character }
|
expect { font << character }
|
||||||
.not_to change(font, :quantity)
|
.not_to change(font, :quantity)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect { font << character }
|
||||||
|
.to change { font.character(character.code) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :character, class: FontHelper::Character do
|
factory :character, class: FontHelper::Character do
|
||||||
initialize_with do
|
initialize_with do
|
||||||
FontHelper::Character.new(code)
|
FontHelper::Character.new(code:)
|
||||||
end
|
end
|
||||||
|
|
||||||
transient do
|
transient do
|
||||||
|
|||||||
Reference in New Issue
Block a user