0
0
Fork 0

Add tests for Rubella::Output::Base

This commit is contained in:
Stormwind 2015-10-22 09:20:32 +02:00
parent 962d70e142
commit b4e8c2d6dc
5 changed files with 64 additions and 0 deletions

View File

@ -15,3 +15,4 @@ require 'rubella/weighting/per_count'
require 'rubella/weighting/per_value'
require 'rubella/weighting/exponential'
require 'rubella/weighting/per_overall_load'
require 'rubella/output/base'

View File

@ -0,0 +1,13 @@
require 'spec_helper'
describe Rubella::Output::Base, '.field_size' do
it "returns the given field_sitze" do
output = Rubella::Output::Base.new nil, 0
expect(output.field_size).to eq(0)
output.field_size = 5
expect(output.field_size).to eq(5)
end
end

View File

@ -0,0 +1,11 @@
require 'spec_helper'
describe Rubella::Output::Base, '.field_size' do
it "returns the given field_sitze" do
output = Rubella::Output::Base.new nil, 5
expect(output.field_size).to eq(5)
end
end

View File

@ -0,0 +1,28 @@
require 'spec_helper'
describe Rubella::Output::Base, '.new' do
it "creates a new Rubella::Output" do
output = Rubella::Output::Base.new nil, nil
expect(output).to be_kind_of(Rubella::Output::Base)
end
it "uses the given data" do
output = Rubella::Output::Implementation.new Rubella::Storage.new([]), nil
expect(output.data).to be_kind_of(Rubella::Storage)
expect(output.data.data).to eq([])
end
it "uses the given field_size" do
output = Rubella::Output::Base.new nil, 5
expect(output.field_size).to eq(5)
end
end
class Rubella::Output::Implementation < Rubella::Output::Base
attr_reader :data
end

View File

@ -0,0 +1,11 @@
require 'spec_helper'
describe Rubella::Output::Base, '.render' do
it "raises NotImplementedError" do
output = Rubella::Output::Base.new nil, nil
expect{ output.render }.to raise_error(NotImplementedError)
end
end