Sha256: 29745a41d2c56b051fc3070b8457d4b6220f32c56c5d10466527fd84fd87ae60

Contents?: true

Size: 667 Bytes

Versions: 4

Compression:

Stored size: 667 Bytes

Contents

RSpec.describe ROM::Plugins::Relation::Schema::Schema do
  let(:klass) { ROM::Plugins::Relation::Schema::Schema }
  let(:schema) do
    klass.create do
      attribute :id, 'form.int'
      attribute :name, 'strict.string'
      attribute :active, 'form.bool'
    end
  end

  describe '#attribute_names' do
    subject! { schema.attribute_names }

    it { is_expected.to match_array([:id, :name, :active])}
  end

  describe '#apply' do
    let(:attributes) do
      {
        id: '1',
        name: 'John',
        active: 'true'
      }
    end

    subject! { schema.apply(attributes) }

    it { is_expected.to eq(id: 1, name: 'John', active: true) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rom-http-0.4.0 spec/unit/rom/plugins/relation/schema/schema_spec.rb
rom-http-0.3.0 spec/unit/rom/plugins/relation/schema/schema_spec.rb
rom-http-0.2.0 spec/unit/rom/plugins/relation/schema/schema_spec.rb
rom-http-0.2.0.beta1 spec/unit/rom/plugins/relation/schema/schema_spec.rb