Sha256: c87a6fb4f0ae4524cc2fd33fc133f5054524fcf81d63976c6fa5725b4f0eca2f
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
require_relative '../../../test_helper' module Vedeu describe CommandRepository do let(:described_class) { CommandRepository } let(:input) { } before do Command.create({ name: 'apple', klass: DummyCommand, options: { keypress: 'a', keyword: 'apple' } }) Command.create({ name: 'banana', klass: DummyCommand, options: { keypress: 'b', keyword: 'banana' } }) end after do CommandRepository.reset end describe '.by_keypress' do let(:subject) { described_class.by_keypress(input) } context 'when the command was found by keypress' do let(:input) { 'b' } it { subject.must_be_instance_of(Command) } it { subject.name.must_equal('banana') } it { subject.name.wont_equal('apple') } it { subject.keypress.must_equal('b') } end end describe '.by_keyword' do let(:subject) { described_class.by_keyword(input) } context 'when the command was found by keyword' do let(:input) { 'apple' } it { subject.must_be_instance_of(Command) } it { subject.keypress.must_equal('a') } it { subject.keypress.wont_equal('b') } it { subject.name.wont_equal('banana') } end end describe '.klass' do let(:subject) { described_class.klass } it { subject.must_equal(Command) } end end end
Version data entries
3 entries across 3 versions & 1 rubygems