Skip to content

Commit

Permalink
Delegate RegistrationResponse#to_json to the params object
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer authored and ndushay committed Jan 5, 2017
1 parent cb7bdcf commit b5b12dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions app/models/dor/registration_response.rb
@@ -1,15 +1,14 @@
module Dor
class RegistrationResponse
attr_reader :params
delegate :to_json, to: :params

def initialize(p_hash)
@params = p_hash
end

def to_txt
@params[:pid]
end

def to_json
@params.to_json
end
end
end
2 changes: 1 addition & 1 deletion spec/controllers/objects_controller_spec.rb
Expand Up @@ -25,7 +25,7 @@
it 'registers the object with the registration service' do
allow(Dor::RegistrationService).to receive(:create_from_request).and_return('pid' => 'druid:xyz')

post :create
post :create, format: :json

expect(Dor::RegistrationService).to have_received(:create_from_request)
expect(response.status).to eq(201)
Expand Down

0 comments on commit b5b12dc

Please sign in to comment.