Sha256: 64cdb091a1672057cbe2bb026d011875c59c71b98f60232424759e68bfb0d41d
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 KB
Contents
require_relative '../../../../test_helper' module Vedeu module Buffer describe Composition do let(:described_class) { Composition } let(:described_instance) { described_class.new(attributes) } let(:subject) { described_instance } let(:json) { File.read(Vedeu.root_path + '/test/support/single_interface.json') } let(:attributes) { Oj.load(json) } it 'returns a Composition instance' do subject.must_be_instance_of(Composition) end it 'has an interface attribute' do subject.interface.must_be_instance_of(Array) end describe '#to_compositor' do let(:subject) { described_instance.to_compositor } it 'returns a Hash' do subject.must_be_instance_of(Hash) end it 'returns the composition as a Compositor format' do subject.must_equal({"dummy"=>[[{:style=>[], :colour=>[]}, {:style=>[:normal], :colour=>[:yellow, :black], :text=>"Some text..."}]]}) end end describe '#to_hash' do let(:subject) { described_instance.to_hash } it 'returns a Hash' do subject.must_be_instance_of(Hash) end it 'returns the composition as a Hash' do subject.must_equal({"interface"=>[{"name"=>"dummy", "line"=>[{"style"=>nil, "foreground"=>nil, "background"=>nil, "stream"=>[{"style"=>["normal"], "foreground"=>"yellow", "background"=>"black", "text"=>"Some text..."}]}]}]}) end end describe '#to_json' do let(:subject) { described_instance.to_json } it 'returns a String' do subject.must_be_instance_of(String) end it 'returns a String' do subject.must_equal("{\"interface\":[{\"name\":\"dummy\",\"line\":[{\"style\":null,\"foreground\":null,\"background\":null,\"stream\":[{\"style\":[\"normal\"],\"foreground\":\"yellow\",\"background\":\"black\",\"text\":\"Some text...\"}]}]}]}") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.25 | test/lib/vedeu/output/buffer/composition_test.rb |
vedeu-0.0.24 | test/lib/vedeu/output/buffer/composition_test.rb |