spec/integration/abstract/commands/update_spec.rb in rom-http-0.5.0 vs spec/integration/abstract/commands/update_spec.rb in rom-http-0.6.0.rc1

- old
+ new

@@ -1,17 +1,25 @@ RSpec.describe ROM::HTTP::Commands::Update do include_context 'setup' let(:relation) do Class.new(ROM::HTTP::Relation) do - dataset :users + schema(:users) do + attribute :id, ROM::Types::Int + attribute :first_name, ROM::Types::String + attribute :last_name, ROM::Types::String + end + + def by_id(id) + with_params(id: id) + end end end context 'with single tuple' do let(:response) { double } - let(:tuple) { double } let(:attributes) { { first_name: 'John', last_name: 'Jackson' } } + let(:tuple) { attributes.merge(id: 1) } let(:command) do Class.new(ROM::HTTP::Commands::Update) do register_as :update relation :users result :one @@ -49,13 +57,13 @@ end context 'with a collection' do let(:response_1) { double } let(:response_2) { double } - let(:tuple_1) { double } - let(:tuple_2) { double } let(:attributes_1) { { first_name: 'John', last_name: 'Jackson' } } let(:attributes_2) { { first_name: 'Jill', last_name: 'Smith' } } + let(:tuple_1) { attributes_1.merge(id: 1) } + let(:tuple_2) { attributes_2.merge(id: 2) } let(:attributes) { [attributes_1, attributes_2] } let(:command) do Class.new(ROM::HTTP::Commands::Update) do register_as :update relation :users