diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 94966ab..4d890d6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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' diff --git a/spec/unit/rubella/output/base/field_size_eql_spec.rb b/spec/unit/rubella/output/base/field_size_eql_spec.rb new file mode 100644 index 0000000..104aa7e --- /dev/null +++ b/spec/unit/rubella/output/base/field_size_eql_spec.rb @@ -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 diff --git a/spec/unit/rubella/output/base/field_size_spec.rb b/spec/unit/rubella/output/base/field_size_spec.rb new file mode 100644 index 0000000..c3725ca --- /dev/null +++ b/spec/unit/rubella/output/base/field_size_spec.rb @@ -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 diff --git a/spec/unit/rubella/output/base/new_spec.rb b/spec/unit/rubella/output/base/new_spec.rb new file mode 100644 index 0000000..4038ed3 --- /dev/null +++ b/spec/unit/rubella/output/base/new_spec.rb @@ -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 diff --git a/spec/unit/rubella/output/base/render_spec.rb b/spec/unit/rubella/output/base/render_spec.rb new file mode 100644 index 0000000..ddb5330 --- /dev/null +++ b/spec/unit/rubella/output/base/render_spec.rb @@ -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