Skip to content

Commit

Permalink
BCDice: テストを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
koi-chan committed Jan 7, 2021
1 parent c7bfef4 commit 7b00264
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/rgrb/plugin/bcdice/discord_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def bcdice(m, command, specified_game_title)
# ゲームシステム名を含むヘッダ
header = "#{header_common}<#{result.game_name}>: "

send_channel(m.channel, result.message_lines, header)
send_channel(m.channel, result.message, header)
end

# git submodule で組み込んでいる BCDice のバージョンを出力する
Expand Down
2 changes: 1 addition & 1 deletion lib/rgrb/plugin/bcdice/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Plugin
# BCDice のラッパープラグイン
module Bcdice
# BCDice の呼び出し結果
BcdiceResult = Struct.new(:message_lines, :game_name)
BcdiceResult = Struct.new(:message, :game_name)

# Bcdice の出力テキスト生成器
class Generator
Expand Down
2 changes: 1 addition & 1 deletion lib/rgrb/plugin/bcdice/irc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def bcdice(m, command, specified_game_title)
# ゲームシステム名を含むヘッダ
header = "#{header_common}<#{result.game_name}>: "

send_notice(m.target, result.message_lines, header)
send_notice(m.target, result.message, header)
end

# git submodule で組み込んでいる BCDice のバージョンを出力する
Expand Down
10 changes: 4 additions & 6 deletions spec/rgrb/plugin/bcdice/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
describe '#bcdice_version' do
it 'BCDice のバージョンを出力する' do
expect(generator.bcdice_version).to(
match(/\ABCDice Version: [0-9]\.[0-9]{2}\.[0-9]{2} \([0-9a-f]{40}\)\z/)
match(/\ABCDice Version: [0-9]\.[0-9]{2}\.[0-9]{2}\z/)
)
end
end
Expand All @@ -31,12 +31,11 @@
subject { generator.bcdice('2d6') }

it 'ゲームシステムとして DiceBot が選ばれる' do
expect(subject.game_type).to eq('DiceBot')
expect(subject.game_name).to eq('DiceBot')
end

it '2d6 の結果が返る' do
expect(subject.message_lines[0].start_with?('(2D6) > ')).to be(true)
expect(subject.message.start_with?('(2D6) > ')).to be(true)
end
end
end
Expand All @@ -52,15 +51,14 @@

context('ソード・ワールド2.0') do
context('k20') do
subject { generator.bcdice('k20', 'SwordWorld2_0') }
subject { generator.bcdice('k20', 'SwordWorld2.0') }

it 'ゲームシステムとして「ソード・ワールド2.0」が選ばれる' do
expect(subject.game_type).to eq('SwordWorld2.0')
expect(subject.game_name).to eq('ソードワールド2.0')
end

it 'k20 の結果が返る' do
expect(subject.message_lines[0].start_with?('KeyNo.20c')).to be(true)
expect(subject.message.start_with?('KeyNo.20c')).to be(true)
end
end
end
Expand Down

0 comments on commit 7b00264

Please sign in to comment.