Skip to content

Commit

Permalink
Bcdice: テストに失敗するようになったのを修正
Browse files Browse the repository at this point in the history
fix: #154
  • Loading branch information
koi-chan committed Jul 27, 2019
1 parent a3c1f3a commit 176360b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/rgrb/plugin/bcdice/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ module Bcdice
class Generator
include PluginBase::Generator

# 生成器を初期化する
def initialize
def configure(*)
super

@bcdice = CgiDiceBot.new
@version_and_commit_id = get_version_and_commit_id
logger.warn("BCDice を読み込みました: #{bcdice_version}")

@bcdice = CgiDiceBot.new
self
end

# BCDice でダイスを振った結果を返す
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 @@ -24,7 +24,7 @@ class IrcAdapter
def initialize(*args)
super

@generator = Generator.new
prepare_generator
@header = 'BCDice'
end

Expand Down
18 changes: 16 additions & 2 deletions spec/rgrb/plugin/bcdice/generator_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
# vim: fileencoding=utf-8

require 'lumberjack'
require_relative '../../../spec_helper'

require 'rgrb/plugin/bcdice/generator'
require 'rgrb/plugin/bcdice/errors'

describe RGRB::Plugin::Bcdice::Generator do
let(:generator) { described_class.new }
let(:generator) do
g = described_class.new
g.instance_variable_set(
:@bcdice,
CgiDiceBot.new
)
g.instance_variable_set(
:@version_and_commit_id,
g.send(:get_version_and_commit_id)
)

g.logger = Lumberjack::Logger.new($stdout, progname: self.class.to_s)

g
end

describe '#bcdice_version' do
it 'BCDice のバージョンを出力する' do
Expand Down

0 comments on commit 176360b

Please sign in to comment.