Skip to content

Commit

Permalink
Adding to_param on UUID extensions (#945)
Browse files Browse the repository at this point in the history
* Adding to_param on UUID extensions

* Adding a spec for UUID.to_param
  • Loading branch information
russ authored and jwoertink committed Nov 15, 2019
1 parent 71dc544 commit 956d3ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/charms/uuid_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "../spec_helper"

describe "UUID charm" do
describe "to_parm" do
it "gets the value as a string" do
uuid = UUID.new("87b3042b-9b9a-41b7-8b15-a93d3f17025e")
uuid.to_param.should eq "87b3042b-9b9a-41b7-8b15-a93d3f17025e"
uuid.to_param.class.should eq String
end
end
end
5 changes: 5 additions & 0 deletions src/charms/uuid_extensions.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
struct UUID
def to_param : String
self.to_s
end
end

0 comments on commit 956d3ab

Please sign in to comment.