Class: TestEvents

Inherits:
Builder::Test show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb

Defined Under Namespace

Classes: Target

Constant Summary

Constants inherited from Minitest::Test

Minitest::Test::PASSTHROUGH_EXCEPTIONS, Minitest::Test::SETUP_METHODS, Minitest::Test::TEARDOWN_METHODS

Constants included from Minitest::Assertions

Minitest::Assertions::E, Minitest::Assertions::UNDEFINED

Constants inherited from Minitest::Runnable

Minitest::Runnable::SIGNALS

Instance Attribute Summary

Attributes inherited from Minitest::Runnable

#assertions, #failures, #time

Instance Method Summary collapse

Methods inherited from Builder::Test

#assert_nothing_raised

Methods inherited from Minitest::Test

#capture_exceptions, #class_name, #clean, i_suck_and_my_tests_are_order_dependent!, make_my_diffs_pretty!, #neuter_exception, #new_exception, parallelize_me!, #run, runnable_methods, #sanitize_exception, test_order, #with_empty_backtrace_filter, #with_info_handler

Methods included from Minitest::Guard

#jruby?, #maglev?, #mri?, #osx?, #rubinius?, #windows?

Methods included from Minitest::Test::LifecycleHooks

#after_setup, #after_teardown, #before_setup, #before_teardown, #teardown

Methods included from Minitest::Reportable

#class_name, #error?, #location, #passed?, #result_code, #skipped?

Methods included from Minitest::Assertions

#_synchronize, #assert, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_mock, #assert_nil, #assert_operator, #assert_output, #assert_path_exists, #assert_predicate, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_silent, #assert_throws, #capture_io, #capture_subprocess_io, #diff, diff, diff=, #exception_details, #fail_after, #flunk, #message, #mu_pp, #mu_pp_for_diff, #pass, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_path_exists, #refute_predicate, #refute_respond_to, #refute_same, #skip, #skip_until, #skipped?, #things_to_diff

Methods inherited from Minitest::Runnable

#failure, inherited, #initialize, #marshal_dump, #marshal_load, methods_matching, #name, #name=, on_signal, #passed?, reset, #result_code, run, #run, run_one_method, runnable_methods, runnables, #skipped?, #time_it, #whatever, with_info_handler

Constructor Details

This class inherits a constructor from Minitest::Runnable

Instance Method Details

#expect(value) ⇒ Object



143
144
145
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 143

def expect(value)
  assert_equal value, @target.events.shift
end

#expect_doneObject



147
148
149
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 147

def expect_done
  assert_nil @target.events.shift
end

#setupObject



43
44
45
46
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 43

def setup
  @target = Target.new
  @xml = Builder::XmlEvents.new(:target=>@target)
end

#test_attributesObject



88
89
90
91
92
93
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 88

def test_attributes
  @xml.a(:b=>"c", :x=>"y")
  expect [:start_tag, :a, {:x => "y", :b => "c"}]
  expect [:end_tag, :a]
  expect_done
end

#test_moderately_complexObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 95

def test_moderately_complex
  @xml.tag! "address-book" do |x|
    x.entry :id=>"1" do
	x.name {
 x.first "Bill"
 x.last "Smith"
	}
	x.address "Cincinnati"
    end
    x.entry :id=>"2" do
	x.name {
 x.first "John"
 x.last "Doe"
	}
	x.address "Columbus"
    end
  end
  expect [:start_tag, "address-book".intern, nil]
  expect [:start_tag, :entry, {:id => "1"}]
  expect [:start_tag, :name, nil]
  expect [:start_tag, :first, nil]
  expect [:text, "Bill"]
  expect [:end_tag, :first]
  expect [:start_tag, :last, nil]
  expect [:text, "Smith"]
  expect [:end_tag, :last]
  expect [:end_tag, :name]
  expect [:start_tag, :address, nil]
  expect [:text, "Cincinnati"]
  expect [:end_tag, :address]
  expect [:end_tag, :entry]
  expect [:start_tag, :entry, {:id => "2"}]
  expect [:start_tag, :name, nil]
  expect [:start_tag, :first, nil]
  expect [:text, "John"]
  expect [:end_tag, :first]
  expect [:start_tag, :last, nil]
  expect [:text, "Doe"]
  expect [:end_tag, :last]
  expect [:end_tag, :name]
  expect [:start_tag, :address, nil]
  expect [:text, "Columbus"]
  expect [:end_tag, :address]
  expect [:end_tag, :entry]
  expect [:end_tag, "address-book".intern]
  expect_done
end

#test_nestedObject



55
56
57
58
59
60
61
62
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 55

def test_nested
  @xml.one { @xml.two }
  expect [:start_tag, :one, nil]
  expect [:start_tag, :two, nil]
  expect [:end_tag, :two]
  expect [:end_tag, :one]
  expect_done
end

#test_simpleObject



48
49
50
51
52
53
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 48

def test_simple
  @xml.one
  expect [:start_tag, :one, nil]
  expect [:end_tag, :one]
  expect_done
end

#test_special_textObject



72
73
74
75
76
77
78
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 72

def test_special_text
  @xml.one("H&R")
  expect [:start_tag, :one, nil]
  expect [:text, "H&R"]
  expect [:end_tag, :one]
  expect_done
end

#test_textObject



64
65
66
67
68
69
70
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 64

def test_text
  @xml.one("a")
  expect [:start_tag, :one, nil]
  expect [:text, "a"]
  expect [:end_tag, :one]
  expect_done
end

#test_text_with_entityObject



80
81
82
83
84
85
86
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/builder-3.2.4/test/test_eventbuilder.rb', line 80

def test_text_with_entity
  @xml.one("H&R")
  expect [:start_tag, :one, nil]
  expect [:text, "H&R"]
  expect [:end_tag, :one]
  expect_done
end