Class: QueryWrapperTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
lib/regexp_wrapper/query_wrapper_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



6
7
8
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 6

def setup
  @queryWrapper = RegexpWrapper::QueryWrapper.new
end

#test_hasObject



15
16
17
18
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 15

def test_has
  express = @queryWrapper.start_with!("a").has!("BBB").has!("DDD").end_with!("z").to_regexp
  assert_equal(/^a.*BBB.*DDD.*z\z/,express)
end

#test_match_end_withObject



24
25
26
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 24

def test_match_end_with
  assert("abc" =~ @queryWrapper.end_with!("c").to_regexp)
end

#test_match_start_withObject



20
21
22
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 20

def test_match_start_with
  assert("abc" =~ @queryWrapper.start_with!("a").to_regexp)
end

#test_match_start_with_a_and_end_with_cObject



28
29
30
31
32
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 28

def test_match_start_with_a_and_end_with_c
  assert(@queryWrapper.start_with!("a").end_with!("c") =~ "abc")
  assert_match(@queryWrapper.start_with!("a").end_with!("c").to_regexp,"abc")
  refute_match(@queryWrapper.start_with!("a").end_with!("c").to_regexp,"abd")
end

#test_start_with_and_end_withObject



10
11
12
13
# File 'lib/regexp_wrapper/query_wrapper_test.rb', line 10

def test_start_with_and_end_with
  express = @queryWrapper.start_with!("a").end_with!("z").to_regexp
  assert_equal(/^a.*z\z/,express)
end