Sha256: afc2023ab3b97b5712ac823c469b215ff8780e711fa0d8d860d8c3f98299b8e8

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

describe Zapata::Revolutionist do
  context 'it should work with' do
    it 'bare module' do
      generated = exec_generation('app/models/testing_module/bare.rb')
      expected = expected(%{require 'rails_helper'

      describe TestingModule::Bare do
        let(:bare) do
          TestingModule::Bare.new
        end
      end})

      expect(generated).to eq(expected)
    end

    it 'nested module' do
      generated = exec_generation('app/models/testing_module/nested/inside.rb')
      expected = expected(%{require 'rails_helper'

      describe TestingModule::Nested::Inside do
        let(:inside) do
          TestingModule::Nested::Inside.new
        end
      end})

      expect(generated).to eq(expected)
    end

    context 'klass methods' do
      before(:all) do
        @generated = exec_generation('app/models/testing_module/klass_methods.rb')
      end

      it '#defined_with_self' do
        has_block('#defined_with_self', %{
          expect(TestingModule::KlassMethods.defined_with_self(5)).to eq(5)
        })
      end

      it '#defined_with_back_back_self' do
        has_block('#defined_with_back_back_self', %{
          expect(TestingModule::KlassMethods.defined_with_back_back_self(5)).to eq(5)
        })
      end

      it '#back_to_public_defined_with_self' do
        has_block('#back_to_public_defined_with_self', %{
          expect(TestingModule::KlassMethods.back_to_public_defined_with_self(5)).to eq(5)
        })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zapata-1.0.0 spec/klass_types_spec.rb