diff options
author | mms <git@sapka.me> | 2024-11-14 22:34:47 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-11-14 22:34:57 +0100 |
commit | 8c084e0faa971e6db265ea39aefb8cf07e39de43 (patch) | |
tree | 899e4f6f8e7e33ab01d09ad917c86fd32944a4bb /spec/lib/ruleset_spec.rb | |
parent | 4d87cb470b2c306c126d2d739d50577702374926 (diff) |
chore: add specs for all classes
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 |