2015-09-03 16:04:13 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2015-09-02 02:53:51 +00:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
describe 'Vulcano::Plugins::Backend::FileCommon' do
|
2015-09-03 08:12:20 +00:00
|
|
|
let(:cls) { Vulcano::Plugins::Backend::FileCommon }
|
|
|
|
let(:backend) { cls.new }
|
2015-09-02 02:53:51 +00:00
|
|
|
|
|
|
|
it 'default type is :unkown' do
|
2015-09-03 08:12:20 +00:00
|
|
|
backend.type.must_equal :unknown
|
2015-09-02 02:53:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with non-empty content' do
|
2015-09-03 08:12:20 +00:00
|
|
|
let(:backend) {
|
|
|
|
Class.new(cls) do
|
2015-09-02 02:53:51 +00:00
|
|
|
def content; 'Hello World'; end
|
|
|
|
end.new
|
2015-09-03 08:12:20 +00:00
|
|
|
}
|
2015-09-02 02:53:51 +00:00
|
|
|
|
|
|
|
it 'must return raw content' do
|
2015-09-03 08:12:20 +00:00
|
|
|
backend.content.must_equal 'Hello World'
|
2015-09-02 02:53:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'must calculate the md5sum of content' do
|
2015-09-03 08:12:20 +00:00
|
|
|
backend.md5sum.must_equal 'b10a8db164e0754105b7a99be72e3fe5'
|
2015-09-02 02:53:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'must calculate the sha256sum of content' do
|
2015-09-03 08:12:20 +00:00
|
|
|
backend.sha256sum.must_equal 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e'
|
2015-09-02 02:53:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|