Sha256: 6f24af3436160b166629f925550812ca488ed322e88b549c6ed51bc5e926a7c9
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true require 'test_helper' module Vedeu module Coercers describe EditorLine do let(:described) { Vedeu::Coercers::EditorLine } let(:instance) { described.new(_value) } let(:_value) {} let(:klass) { Vedeu::Editor::Line } describe '#initialize' do it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@value').must_equal(_value) } end describe '.coerce' do it { described.must_respond_to(:coerce) } end describe '#coerce' do subject { instance.coerce } it { subject.must_be_instance_of(klass) } context 'when the value is already the target class' do let(:_value) { klass.new } it { subject.must_be_instance_of(klass) } it { subject.must_equal(_value) } end context 'when the value is a String' do context 'when the value is empty' do let(:_value) { '' } it { subject.must_be_instance_of(klass) } it { subject.collection.must_equal('') } end context 'when the value is an String' do let(:_value) { 'some value...' } it { subject.must_be_instance_of(klass) } it { subject.collection.must_equal(_value) } end end context 'when the value is not already the target class or ' \ 'a string' do it { subject.must_be_instance_of(klass) } end end end # EditorLine end # Coercers end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.8.17 | test/lib/vedeu/coercers/editor_line_test.rb |
vedeu-0.8.16 | test/lib/vedeu/coercers/editor_line_test.rb |