Sha256: cc86d51fdea83ed8b24465adfd5df0cbfd50e17a48021c3f7b7c5c1bff5862f1

Contents?: true

Size: 1.09 KB

Versions: 5

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Magicka::MethodBuilder do
  subject(:builder) { described_class.new(klass) }

  let(:klass)    { Class.new }
  let(:instance) { klass.new }

  describe '#add_template' do
    let(:template) { 'path_to_template' }

    it do
      expect { builder.add_template(template) }
        .to add_method(:template)
        .to(klass)
    end

    context 'when method is build as requested' do
      before { builder.add_template(template) }

      it 'returns the defined template when method is called' do
        expect(instance.template).to eq(template)
      end
    end
  end

  describe '#add_template_folder' do
    let(:folder) { 'path_to_template_folder' }

    it do
      expect { builder.add_template_folder(folder) }
        .to add_method(:template_folder)
        .to(klass)
    end

    context 'when method is build as requested' do
      before { builder.add_template_folder(folder) }

      it 'returns the defined template folder when method is called' do
        expect(instance.template_folder).to eq(folder)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
magicka-0.4.0 spec/lib/magicka/method_builder_spec.rb
magicka-0.3.1 spec/lib/magicka/method_builder_spec.rb
magicka-0.3.0 spec/lib/magicka/method_builder_spec.rb
magicka-0.2.1 spec/lib/magicka/method_builder_spec.rb
magicka-0.2.0 spec/lib/magicka/method_builder_spec.rb