Sha256: 278cb7ccc9662c0a107cc41f9c7d909c24b34e0cae4c43f56f37798bd93ced79

Contents?: true

Size: 946 Bytes

Versions: 7

Compression:

Stored size: 946 Bytes

Contents

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

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

    it { should 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

7 entries across 7 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/support/shared/examples/search_with.rb
metasploit-model-0.30.0 spec/support/shared/examples/search_with.rb
metasploit-model-0.30.0-java spec/support/shared/examples/search_with.rb
metasploit-model-0.29.2 spec/support/shared/examples/search_with.rb
metasploit-model-0.29.2-java spec/support/shared/examples/search_with.rb
metasploit-model-0.29.0 spec/support/shared/examples/search_with.rb
metasploit-model-0.29.0-java spec/support/shared/examples/search_with.rb