# 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