Sha256: 1ccff4d06e12cecd94cd3455df964a44a49a476a19aac0853654859f9a9e2b82

Contents?: true

Size: 1.34 KB

Versions: 23

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe Metasploit::Model::Search::Operation::Association do
  subject(:operation) {
    described_class.new(
        source_operation: source_operation
    )
  }

  let(:source_operation) {
    nil
  }

  context 'validation' do
    before(:each) do
      operation.valid?
    end

    context 'errors on #source_operation' do
      subject(:source_operation_errors) {
        operation.errors[:source_operation]
      }

      let(:invalid_error) {
        I18n.translate!('errors.messages.invalid')
      }

      context 'with #source_operation' do
        let(:source_operation) {
          double('#source_operation', valid?: valid)
        }

        context 'with valid' do
          let(:valid) {
            true
          }

          it { should_not include(invalid_error) }
        end

        context 'without valid' do
          let(:valid) {
            false
          }

          it { should include(invalid_error) }
        end
      end

      context 'without #source_operation' do
        let(:blank_error) {
          I18n.translate!('errors.messages.blank')
        }

        let(:source_operation) {
          nil
        }

        it { should include(blank_error) }
        it { should_not include(invalid_error) }
      end
    end
  end

  it { should_not respond_to :value }
  it { should_not respond_to :value= }
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
metasploit-model-1.0.0.pre.rails.pre.4.0 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.30.0 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.30.0-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.29.2 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.29.2-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.29.0 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.29.0-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.28.0 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.28.0-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.28.0.pre.engine.pre.requires spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.4 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.4-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.3 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.3-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.2 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.2-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.1 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.1-java spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.0 spec/app/models/metasploit/model/search/operation/association_spec.rb
metasploit-model-0.27.0-java spec/app/models/metasploit/model/search/operation/association_spec.rb