diff options
Diffstat (limited to 'spec/lib/ruleset_spec.rb')
-rw-r--r-- | spec/lib/ruleset_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/ruleset_spec.rb b/spec/lib/ruleset_spec.rb new file mode 100644 index 0000000..e7a6904 --- /dev/null +++ b/spec/lib/ruleset_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'rspec' +require_relative '../../lib/chotto/ruleset' +require_relative '../../lib/chotto/messages' + +RSpec.describe Chotto::RuleSet do + let(:db) { instance_double('Chotto::Database') } + let(:messages) { double('Chotto::Messages', mth: true) } + let(:rule) do + proc do + messages.mth + end + end + let(:subject) do + Chotto::RuleSet.new('a name', db, rule) + end + + describe '#run' do + it 'evaluates the run block' do + expect(Chotto::Messages).to receive(:new).with(db: db).and_return(messages) + expect(messages).to receive(:mth) + + subject.run + end + end +end |