
require_relative '../lib/message_filter'

describe MessageFilter do
	shared_examples 'MessageFilter with argument "foo"' do
		it { is_expected.to be_detect('hello from foo') }
		it { is_expected.not_to be_detect('hello, world!') }
	end

  describe 'with argument "foo"' do
    subject { MessageFilter.new('foo') }
    it_behaves_like 'MessageFilter with argument "foo"'
  end

  describe 'with argument "foo","bar"' do
    subject { MessageFilter.new('foo', 'bar') }
    it { is_expected.to be_detect('hello from bar') }
    it_behaves_like 'MessageFilter with argument "foo"'
  end
end


require_relative '../lib/message_filter'

describe MessageFilter do
	shared_examples 'MessageFilter with argument "foo"' do
		it { is_expected.to be_detect('hello from foo') }
		it { is_expected.not_to be_detect('hello, world!') }
	end

  context 'with argument "foo"' do
    subject { MessageFilter.new('foo') }
    it_behaves_like 'MessageFilter with argument "foo"'
  end

  context 'with argument "foo","bar"' do
    subject { MessageFilter.new('foo', 'bar') }
    it { is_expected.to be_detect('hello from bar') }
    it_behaves_like 'MessageFilter with argument "foo"'
  end
end

Use context instead of describe to express target status
Use context instead of describe to express target status
