Skip to content

Commit

Permalink
remove ShowUser rescue
Browse files Browse the repository at this point in the history
I think it’s better to not rescue this exception. We’ll have to handle
RecordNotFound.
  • Loading branch information
npauzenga committed Jan 19, 2016
1 parent 1f8e4fb commit ff0c196
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
6 changes: 0 additions & 6 deletions app/interactors/show_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@ def validate_input

def execute
context.user = User.find(context.id)
rescue ActiveRecord::RecordNotFound
context.user = nil
end

def validate_output
context.fail!(error: "invalid user") unless context.user
end
end
14 changes: 0 additions & 14 deletions spec/interactors/show_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,5 @@
expect(subject.error).to eq("invalid user id")
end
end

context "when user output is invalid" do
subject do
described_class.call(id: 0)
end

it "fails" do
is_expected.to be_a_failure
end

it "returns an error" do
expect(subject.error).to eq("invalid user")
end
end
end
end

0 comments on commit ff0c196

Please sign in to comment.