Class: MarkdownExec::FilterTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



231
232
233
234
235
236
237
# File 'lib/filter.rb', line 231

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

#test_bash_only_condition_trueObject



291
292
293
294
295
# File 'lib/filter.rb', line 291

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

#test_default_caseObject



297
298
299
# File 'lib/filter.rb', line 297

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

#test_exclude_expect_blocks_conditionObject



246
247
248
249
250
# File 'lib/filter.rb', line 246

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



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

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



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

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



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

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



240
241
242
243
244
# File 'lib/filter.rb', line 240

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

#test_shell_exclude_conditionObject



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

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



285
286
287
288
289
# File 'lib/filter.rb', line 285

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



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

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