Skip to content

Commit

Permalink
Merge pull request #39 from zonuexe/feature/pikarin_janken
Browse files Browse the repository at this point in the history
Add Cure.peace.pikarin_janken (singleton method)
  • Loading branch information
sue445 committed Aug 28, 2014
2 parents a27b60c + aed2b52 commit d46ca44
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/rubicure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ def self.method_missing(name, *args)
super
end
end

[Cure.peace, Cure.cure_peace].each do |peace|
class << peace
HANDS =
(['グー'] * 13) +
(['チョキ'] * 14) +
(['パー'] * 15) +
['グッチョッパー']
MESSAGE = <<EOF
ピカピカピカリン
ジャンケンポン!
(%s)
EOF
def pikarin_janken
print_by_line(MESSAGE % HANDS.sample)
end
alias janken pikarin_janken
end
end
end

module Shiny
Expand Down
9 changes: 9 additions & 0 deletions spec/girl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,13 @@
it { expect{ subject }.to raise_error NoMethodError }
end
end

describe "cure_peace#pikarin_janken" do
let(:girl){ Cure.peace }

it do
expect(girl.pikarin_janken).
to match %r/ピカピカピカリン\nジャンケンポン!\n(.+)/
end
end
end

0 comments on commit d46ca44

Please sign in to comment.