Class: MarkdownExec::FilterTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



252
253
254
255
256
257
258
# File 'lib/filter.rb', line 252

def setup
  @options = {}
  @fcb = FCB.new(
    dname: nil,
    oname: nil
  )
end

#test_bash_only_condition_trueObject



312
313
314
315
316
# File 'lib/filter.rb', line 312

def test_bash_only_condition_true
  @options[:bash_only] = true
  @fcb.shell = ShellType::BASH
  assert Filter.fcb_select?(@options, @fcb)
end

#test_default_caseObject



318
319
320
# File 'lib/filter.rb', line 318

def test_default_case
  assert Filter.fcb_select?(@options, @fcb)
end

#test_exclude_expect_blocks_conditionObject



267
268
269
270
271
# File 'lib/filter.rb', line 267

def test_exclude_expect_blocks_condition
  @options[:exclude_expect_blocks] = true
  @fcb.type = 'expect'
  refute Filter.fcb_select?(@options, @fcb)
end

#test_hidden_name_conditionObject



273
274
275
276
277
278
# File 'lib/filter.rb', line 273

def test_hidden_name_condition
  @options[:hide_blocks_by_name] = true
  @options[:block_name_hidden_match] = 'hidden'
  @fcb.oname = 'hidden_block'
  refute Filter.fcb_select?(@options, @fcb)
end

#test_include_name_conditionObject



280
281
282
283
284
285
# File 'lib/filter.rb', line 280

def test_include_name_condition
  @options[:hide_blocks_by_name] = true
  @options[:block_name_indlude_match] = 'include'
  @fcb.oname = 'include_block'
  assert Filter.fcb_select?(@options, @fcb)
end

#test_name_select_conditionObject



300
301
302
303
304
# File 'lib/filter.rb', line 300

def test_name_select_condition
  @options[:select_by_name_regex] = 'select'
  @fcb.oname = 'select_this'
  assert Filter.fcb_select?(@options, @fcb)
end

#test_no_chrome_conditionObject

Tests for fcb_select? method



261
262
263
264
265
# File 'lib/filter.rb', line 261

def test_no_chrome_condition
  @options[:no_chrome] = true
  @fcb.chrome = true
  refute Filter.fcb_select?(@options, @fcb)
end

#test_shell_exclude_conditionObject



294
295
296
297
298
# File 'lib/filter.rb', line 294

def test_shell_exclude_condition
  @options[:exclude_by_shell_regex] = 'exclude_this'
  @fcb.shell = 'exclude_this_shell'
  refute Filter.fcb_select?(@options, @fcb)
end

#test_shell_select_conditionObject



306
307
308
309
310
# File 'lib/filter.rb', line 306

def test_shell_select_condition
  @options[:select_by_shell_regex] = 'select_this'
  @fcb.shell = 'select_this_shell'
  assert Filter.fcb_select?(@options, @fcb)
end

#test_wrap_name_conditionObject



287
288
289
290
291
292
# File 'lib/filter.rb', line 287

def test_wrap_name_condition
  @options[:hide_blocks_by_name] = true
  @options[:block_name_wrapper_match] = 'wrap'
  @fcb.oname = 'wrap_block'
  assert Filter.fcb_select?(@options, @fcb)
end