Sha256: 9db8b5be6215bd3bb5029e82f46bcbc770b3a635328bae6680d3bce738c901d8

Contents?: true

Size: 965 Bytes

Versions: 8

Compression:

Stored size: 965 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(:each) 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

8 entries across 8 versions & 1 rubygems

Version Path
metasploit-model-1.0.2 spec/support/shared/examples/search_with.rb
metasploit-model-1.0.1 spec/support/shared/examples/search_with.rb
metasploit-model-1.0.0 spec/support/shared/examples/search_with.rb
metasploit-model-0.30.2 spec/support/shared/examples/search_with.rb
metasploit-model-0.30.2-java spec/support/shared/examples/search_with.rb
metasploit-model-0.30.1 spec/support/shared/examples/search_with.rb
metasploit-model-0.30.1-java spec/support/shared/examples/search_with.rb
metasploit-model-0.30.1.pre.rspec.pre.3.pre.1 spec/support/shared/examples/search_with.rb