Sha256: 0887c85ae3c1471d2efba3d46dab8efdabd0673550727debd708b036af3940de
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 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 '.find_by_input' do let(:subject) { described_class.find_by_input(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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.11 | test/lib/vedeu/repository/command_repository_test.rb |