Sha256: 391fbff8e1d7e735147525ecc1818e2dfaa3f802a3d5ed75871fd3a9aa702c60

Contents?: true

Size: 968 Bytes

Versions: 22

Compression:

Stored size: 968 Bytes

Contents

RSpec.shared_examples_for 'search_with' do |operation_class, options={}|
  name = options.fetch(:name)

  context name.to_s do
    subject(:with_operator) do
      base_class.search_with_operator_by_name[name]
    end

    it { is_expected.to be_a operation_class }

    options.each do |key, value|
      # skip :name since it use used to look up operator, so it's already been checked or with_operator would be `nil`
      unless key == :name
        it "has #{key.inspect} of #{value.inspect}" do
          expect(with_operator.send(key)).to eq(value)
        end
      end
    end

    context 'help' do
      subject(:help) do
        with_operator.help
      end

      context 'with en locale' do
        around(:example) do |example|
          I18n.with_locale(:en) do
            example.run
          end
        end

        it 'should have translation' do
          expect(help).not_to include('translation missing')
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
metasploit-model-5.0.2 spec/support/shared/examples/search_with.rb
metasploit-model-5.0.1 spec/support/shared/examples/search_with.rb
metasploit-model-5.0.0 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.6 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.5 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.4 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.3 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.2 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.1 spec/support/shared/examples/search_with.rb
metasploit-model-4.0.0 spec/support/shared/examples/search_with.rb
metasploit-model-3.1.4 spec/support/shared/examples/search_with.rb
metasploit-model-3.1.3 spec/support/shared/examples/search_with.rb
metasploit-model-3.1.2 spec/support/shared/examples/search_with.rb
metasploit-model-3.1.1 spec/support/shared/examples/search_with.rb
metasploit-model-3.1.0 spec/support/shared/examples/search_with.rb
metasploit-model-3.0.0 spec/support/shared/examples/search_with.rb
metasploit-model-2.0.4 spec/support/shared/examples/search_with.rb
metasploit-model-2.0.3 spec/support/shared/examples/search_with.rb
metasploit-model-2.0.2 spec/support/shared/examples/search_with.rb
metasploit-model-2.0.1 spec/support/shared/examples/search_with.rb