Sha256: 427be5bc9d34f5fb5cd0fca469f45c630a57acabad644e0f5ba3ea573852a88c

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

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

  delegate :to, to: :the_block

  built_with :the_block
end

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

  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

4 entries across 4 versions & 1 rubygems

Version Path
danica-2.7.4 spec/lib/danica/expressable_spec.rb
danica-2.7.3 spec/lib/danica/expressable_spec.rb
danica-2.7.2 spec/lib/danica/expressable_spec.rb
danica-2.7.1 spec/lib/danica/expressable_spec.rb