Skip to content

Commit

Permalink
Added the create_uuid method
Browse files Browse the repository at this point in the history
  • Loading branch information
Marin Usalj committed Jun 17, 2012
1 parent 2370bff commit 0da77ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions motion/core.rb
Expand Up @@ -20,5 +20,12 @@ def p(arg)
NSLog arg.inspect
end

def create_uuid
uuid = CFUUIDCreate(nil)
uuid_string = CFUUIDCreateString(nil, uuid)
CFRelease(uuid)
uuid_string
end

end
BW = BubbleWrap
12 changes: 12 additions & 0 deletions spec/motion/core_spec.rb
Expand Up @@ -37,6 +37,18 @@ def bundle.localizedStringForKey(key, value:value, table:table); @arguments = [k

end

describe "uuid" do

it "creates always the new UUID" do
previous = BW.create_uuid
10.times do
uuid = BW.create_uuid
uuid.should.not.equal previous
uuid.size.should.equal 36
previous = uuid
end
end

end

end

0 comments on commit 0da77ef

Please sign in to comment.