Class: MarkdownExec::FilterTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



203
204
205
206
207
208
209
# File 'lib/filter.rb', line 203

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

#test_bash_only_condition_trueObject



263
264
265
266
267
# File 'lib/filter.rb', line 263

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

#test_default_caseObject



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

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

#test_exclude_expect_blocks_conditionObject



218
219
220
221
222
# File 'lib/filter.rb', line 218

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

#test_hidden_name_conditionObject



224
225
226
227
228
229
# File 'lib/filter.rb', line 224

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



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

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



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

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



212
213
214
215
216
# File 'lib/filter.rb', line 212

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

#test_shell_exclude_conditionObject



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

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



257
258
259
260
261
# File 'lib/filter.rb', line 257

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



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

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