Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cure.peace.pikarin_janken (singleton method) #39

Merged
merged 5 commits into from
Aug 28, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

(['チョキ'] * 14) +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

(['パー'] * 15) +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

['グッチョッパー']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

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