Sha256: bd9eb6db982f81001e54ed2bca0998ccfd19d0c0ec8e72591469e8cd84531722

Contents?: true

Size: 767 Bytes

Versions: 8

Compression:

Stored size: 767 Bytes

Contents

require 'spec_helper'

module Capistrano
  module Template
    module Helpers
      describe TemplateDigester do

        subject do
          TemplateDigester.new(renderer, digest_algo)
        end

        let(:text) { 'my very long text' }
        let(:renderer) { OpenStruct.new(as_str: text) }
        let(:digest_algo) { ->(data) { Digest::MD5.hexdigest(data) } }

        describe '#digest' do

          it 'uses digest_algo to create a digest' do
            expect(subject.digest).to eq(digest_algo.call(text))
          end

        end

        describe '.new' do

          it 'is a delegator' do
            expect(renderer).to receive(:call_it).with(1, 2, 3)
            subject.call_it(1, 2, 3)
          end

        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
capistrano-template-0.0.9 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.8 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.7 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.5 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.4 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.3 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.2 spec/unit/capistrano/template/helpers/template_digester_spec.rb
capistrano-template-0.0.1 spec/unit/capistrano/template/helpers/template_digester_spec.rb