blob: e7a69046cf87423bb19049865945b254a9a18153 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
|