Add first test for the Storage
This commit is contained in:
parent
d592e315d8
commit
7d7f01b6d2
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue