Sha256: 05477831b4a6ae97874745bfa24d22cb0a6861f932859ab862dcbaac85b21fb5

Contents?: true

Size: 855 Bytes

Versions: 3

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

class Danica::Expressable::Dummy
  include Danica::Expressable

  delegate :to, to: :the_block

  built_with :the_block
end

describe Danica::Expressable do
  subject do
    clazz.create(:x) { x }
  end

  let(:clazz) { described_class::Dummy }

  it_behaves_like 'an object that respond to basic_methods', ignore: %i[valued? container? is_grouped? priority]

  describe '.build' do
    it 'responds to build' do
      expect(clazz).to respond_to(:build)
    end

    it 'returns a child class object' do
      expect(clazz.build(:x) do
        x
      end.superclass).to be(clazz)
    end
  end

  describe '.create' do
    it 'responds to create' do
      expect(clazz).to respond_to(:create)
    end

    it do
      expect(clazz.create(:x) do
        x
      end).to be_a(clazz)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danica-2.7.7 spec/lib/danica/expressable_spec.rb
danica-2.7.6 spec/lib/danica/expressable_spec.rb
danica-2.7.5 spec/lib/danica/expressable_spec.rb