0
0
Fork 0

Add first test for the Storage

This commit is contained in:
Stormwind 2015-05-01 08:10:36 +02:00
parent d592e315d8
commit 7d7f01b6d2
2 changed files with 27 additions and 0 deletions

View File

@ -10,4 +10,20 @@ describe Rubella::Storage, '.add' do
expect(storage_new.data).to eq([0, 1, 2, 3, 4, 5])
end
it "uses the length of the first given Storage" do
storage_1 = Rubella::Storage.new [3, 4, 5, 6, 7], 4
storage_2 = Rubella::Storage.new [0, 1, 2], 3
storage_new = storage_1.add storage_2
expect(storage_new.length).to eq 4
end
it "chops the data to the given length" do
storage_1 = Rubella::Storage.new [3, 4, 5, 6, 7], 4
storage_2 = Rubella::Storage.new [0, 1, 2], 3
storage_new = storage_1.add storage_2
expect(storage_new.data).to eq([0, 1, 2, 3])
end
end

View File

@ -0,0 +1,11 @@
require 'spec_helper'
describe Rubella::Storage, '.length' do
it "returns the current length" do
storage = Rubella::Storage.new [3, 4, 5]
expect(storage.length).to eq 3
end
end