Sha256: 414a09ff9e488790713dcde74887de5dddb615fb2b734695444ca07383897f4a

Contents?: true

Size: 650 Bytes

Versions: 50

Compression:

Stored size: 650 Bytes

Contents

# Checks that the string matches the
RSpec::Matchers.define :match_string_exactly do |string|
  failure_message do |regexp|
    match = regexp.match(string)

    failure_message = "expected #{regexp} to match #{string}"

    if match
      failure_message << ', but'

      unless match.pre_match.empty?
        failure_message << " pre-match is #{match.pre_match}"
      end

      unless match.post_match.empty?
        failure_message << " post-match is #{match.post_match}"
      end
    end

    failure_message
  end

  match do |regexp|
    match = regexp.match(string)

    match && match.pre_match.empty? && match.post_match.empty?
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
wg-metasploit_data_models-4.1.4.02 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.5 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.4 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.3 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.2 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.1 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-6.0.0 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.6 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.5 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.4 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.3 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.2 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.1 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-5.0.0 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.1.4 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.1.3 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.1.2 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.1.1 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.1.0 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-4.0.2 spec/support/matchers/match_regex_exactly.rb