Sha256: 53e9111ecc99d91c462fd715f204eabee41bc06e4ccc13b734ce7120a34454a7

Contents?: true

Size: 661 Bytes

Versions: 69

Compression:

Stored size: 661 Bytes

Contents

# Checks that the string matches the
RSpec::Matchers.define :match_string_exactly do |string|
  failure_message_for_should 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

69 entries across 69 versions & 1 rubygems

Version Path
metasploit_data_models-1.0.0.pre.rails.pre.4.0b spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-1.0.0.pre.rails.pre.4.0a spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.24.0 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.3.pre.autoload spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.2 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.2-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.1 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.1-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.0 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.23.0-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.8 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.8-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.7 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.7-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.6 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.6-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.5 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.5-java spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.4 spec/support/matchers/match_regex_exactly.rb
metasploit_data_models-0.22.4-java spec/support/matchers/match_regex_exactly.rb