Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 5 fix announcement service #326

Merged
merged 10 commits into from
Jun 20, 2024
2 changes: 1 addition & 1 deletion app/services/concerns/talk_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def find_resource
end

def update_resource
resource.assign_attributes unrooted_params
resource.assign_attributes unrooted_params.to_h
rescue ArgumentError => e
reraise_enum_errors e
rescue NameError => e
Expand Down
16 changes: 5 additions & 11 deletions spec/support/shared_examples_for_services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

describe '#unrooted_params' do
let(:create_params){ { resource.table_name => { foo: 1 } } }
subject{ service.unrooted_params }
subject{ service.unrooted_params.to_h }
it{ is_expected.to include 'foo' => 1 }

it 'should permit the params' do
Expand Down Expand Up @@ -98,19 +98,13 @@
end

it 'should set the user id' do
expect{
service.set_user
}.to change{
service.unrooted_params[:user_id]
}.from(nil).to current_user.id
service.set_user
expect(service.unrooted_params[:user_id]).to eq(current_user.id)
end

it 'should accept a block' do
expect{
service.set_user{ unrooted_params[:foo] = 123 }
}.to change{
service.unrooted_params[:foo]
}.from(nil).to 123
service.set_user{ unrooted_params[:foo] = 123 }
expect(service.unrooted_params[:foo]).to eq(123)
end
end
end
Expand Down
Loading