phlex-stimulus 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +16 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +341 -0
  6. data/Rakefile +12 -0
  7. data/lib/generators/phlex/stimulus/controller/USAGE +5 -0
  8. data/lib/generators/phlex/stimulus/controller/controller_generator.rb +49 -0
  9. data/lib/generators/phlex/stimulus/controller/templates/component.rb.erb +30 -0
  10. data/lib/generators/phlex/stimulus/controller/templates/controller.ts.erb +23 -0
  11. data/lib/generators/phlex/stimulus/generator_mixin.rb +21 -0
  12. data/lib/generators/phlex/stimulus/install/USAGE +5 -0
  13. data/lib/generators/phlex/stimulus/install/install_generator.rb +111 -0
  14. data/lib/generators/phlex/stimulus/install/templates/app/components/base.rb.erb +29 -0
  15. data/lib/generators/phlex/stimulus/install/templates/app/components/chain_controller.rb.erb +29 -0
  16. data/lib/generators/phlex/stimulus/install/templates/app/components/classlist_controller.rb.erb +30 -0
  17. data/lib/generators/phlex/stimulus/install/templates/app/components/controller.rb.erb +10 -0
  18. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_chain.rb.erb +32 -0
  19. data/lib/generators/phlex/stimulus/install/templates/app/components/controller_template.rb.erb +24 -0
  20. data/lib/generators/phlex/stimulus/install/templates/app/components/log_controller.rb.erb +33 -0
  21. data/lib/generators/phlex/stimulus/install/templates/app/components/sleep_controller.rb.erb +30 -0
  22. data/lib/generators/phlex/stimulus/install/templates/app/components.rb.erb +7 -0
  23. data/lib/generators/phlex/stimulus/install/templates/app/javascript/application.ts.erb +5 -0
  24. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/application.ts.erb +10 -0
  25. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chain_controller.ts.erb +32 -0
  26. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/chainable_controller.ts.erb +44 -0
  27. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/classlist_controller.ts.erb +30 -0
  28. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/index.ts.erb +4 -0
  29. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/log_controller.ts.erb +25 -0
  30. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/sleep_controller.ts.erb +19 -0
  31. data/lib/generators/phlex/stimulus/install/templates/app/javascript/controllers/typed_controller.ts.erb +53 -0
  32. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/misc.ts.erb +37 -0
  33. data/lib/generators/phlex/stimulus/install/templates/app/javascript/utils/template.ts.erb +11 -0
  34. data/lib/phlex/stimulus/components/base.rb +81 -0
  35. data/lib/phlex/stimulus/components/controller.rb +170 -0
  36. data/lib/phlex/stimulus/components.rb +9 -0
  37. data/lib/phlex/stimulus/version.rb +8 -0
  38. data/lib/phlex/stimulus.rb +15 -0
  39. data/sorbet/config +7 -0
  40. data/sorbet/rbi/annotations/.gitattributes +1 -0
  41. data/sorbet/rbi/annotations/actionmailer.rbi +15 -0
  42. data/sorbet/rbi/annotations/actionpack.rbi +430 -0
  43. data/sorbet/rbi/annotations/actionview.rbi +75 -0
  44. data/sorbet/rbi/annotations/activejob.rbi +50 -0
  45. data/sorbet/rbi/annotations/activemodel.rbi +119 -0
  46. data/sorbet/rbi/annotations/activerecord.rbi +172 -0
  47. data/sorbet/rbi/annotations/activesupport.rbi +561 -0
  48. data/sorbet/rbi/annotations/globalid.rbi +30 -0
  49. data/sorbet/rbi/annotations/minitest.rbi +116 -0
  50. data/sorbet/rbi/annotations/railties.rbi +104 -0
  51. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  52. data/sorbet/rbi/dsl/.gitattributes +1 -0
  53. data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
  54. data/sorbet/rbi/gems/.gitattributes +1 -0
  55. data/sorbet/rbi/gems/action_text-trix@2.1.19.rbi +9 -0
  56. data/sorbet/rbi/gems/actioncable@8.1.3.rbi +9 -0
  57. data/sorbet/rbi/gems/actionmailbox@8.1.3.rbi +9 -0
  58. data/sorbet/rbi/gems/actionmailer@8.1.3.rbi +9 -0
  59. data/sorbet/rbi/gems/actionpack@8.1.3.rbi +20478 -0
  60. data/sorbet/rbi/gems/actiontext@8.1.3.rbi +9 -0
  61. data/sorbet/rbi/gems/actionview@8.1.3.rbi +14722 -0
  62. data/sorbet/rbi/gems/activejob@8.1.3.rbi +9 -0
  63. data/sorbet/rbi/gems/activemodel@8.1.3.rbi +9 -0
  64. data/sorbet/rbi/gems/activerecord@8.1.3.rbi +9 -0
  65. data/sorbet/rbi/gems/activestorage@8.1.3.rbi +9 -0
  66. data/sorbet/rbi/gems/activesupport@8.1.3.rbi +20153 -0
  67. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  68. data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
  69. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  70. data/sorbet/rbi/gems/booleans@0.1.3.rbi +31 -0
  71. data/sorbet/rbi/gems/builder@3.3.0.rbi +9 -0
  72. data/sorbet/rbi/gems/byebug@12.0.0.rbi +49 -0
  73. data/sorbet/rbi/gems/concurrent-ruby@1.3.8.rbi +10656 -0
  74. data/sorbet/rbi/gems/connection_pool@3.0.2.rbi +9 -0
  75. data/sorbet/rbi/gems/crass@1.0.7.rbi +648 -0
  76. data/sorbet/rbi/gems/date@3.5.1.rbi +391 -0
  77. data/sorbet/rbi/gems/drb@2.2.3.rbi +9 -0
  78. data/sorbet/rbi/gems/erb@6.0.6.rbi +1600 -0
  79. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  80. data/sorbet/rbi/gems/globalid@1.4.0.rbi +9 -0
  81. data/sorbet/rbi/gems/i18n@1.15.2.rbi +2285 -0
  82. data/sorbet/rbi/gems/io-console@0.8.2.rbi +9 -0
  83. data/sorbet/rbi/gems/json@2.21.1.rbi +2289 -0
  84. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  85. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  86. data/sorbet/rbi/gems/loofah@2.25.2.rbi +1134 -0
  87. data/sorbet/rbi/gems/mail@2.9.1.rbi +9 -0
  88. data/sorbet/rbi/gems/marcel@1.2.1.rbi +9 -0
  89. data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +9 -0
  90. data/sorbet/rbi/gems/minitest@6.0.6.rbi +1482 -0
  91. data/sorbet/rbi/gems/net-imap@0.6.4.1.rbi +9 -0
  92. data/sorbet/rbi/gems/net-pop@0.1.2.rbi +9 -0
  93. data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +244 -0
  94. data/sorbet/rbi/gems/net-smtp@0.5.1.rbi +9 -0
  95. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  96. data/sorbet/rbi/gems/nio4r@2.7.5.rbi +9 -0
  97. data/sorbet/rbi/gems/nokogiri@1.19.4.rbi +8168 -0
  98. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  99. data/sorbet/rbi/gems/phlex-rails@2.4.0.rbi +1945 -0
  100. data/sorbet/rbi/gems/phlex@2.4.1.rbi +1413 -0
  101. data/sorbet/rbi/gems/pp@0.6.4.rbi +387 -0
  102. data/sorbet/rbi/gems/prettyprint@0.2.0.rbi +455 -0
  103. data/sorbet/rbi/gems/prism@1.9.0.rbi +42226 -0
  104. data/sorbet/rbi/gems/racc@1.8.1.rbi +165 -0
  105. data/sorbet/rbi/gems/rack-session@2.1.2.rbi +756 -0
  106. data/sorbet/rbi/gems/rack-test@2.2.0.rbi +681 -0
  107. data/sorbet/rbi/gems/rack@3.2.6.rbi +4653 -0
  108. data/sorbet/rbi/gems/rackup@2.3.1.rbi +9 -0
  109. data/sorbet/rbi/gems/rails-dom-testing@2.3.0.rbi +517 -0
  110. data/sorbet/rbi/gems/rails-html-sanitizer@1.7.1.rbi +620 -0
  111. data/sorbet/rbi/gems/rails@8.1.3.rbi +9 -0
  112. data/sorbet/rbi/gems/railties@8.1.3.rbi +3507 -0
  113. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  114. data/sorbet/rbi/gems/rake@13.4.2.rbi +3130 -0
  115. data/sorbet/rbi/gems/rbi@0.4.0.rbi +5706 -0
  116. data/sorbet/rbi/gems/rbs@4.0.3.rbi +6908 -0
  117. data/sorbet/rbi/gems/refract@1.1.0.rbi +9 -0
  118. data/sorbet/rbi/gems/reline@0.6.3.rbi +2446 -0
  119. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  120. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  121. data/sorbet/rbi/gems/rubocop-espago@1.3.0.rbi +9 -0
  122. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  123. data/sorbet/rbi/gems/rubydex@0.2.9.rbi +841 -0
  124. data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
  125. data/sorbet/rbi/gems/shoulda-context@2.0.0.rbi +544 -0
  126. data/sorbet/rbi/gems/spoom@1.8.4.rbi +6738 -0
  127. data/sorbet/rbi/gems/tapioca@0.19.2.rbi +3599 -0
  128. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  129. data/sorbet/rbi/gems/timeout@0.6.1.rbi +200 -0
  130. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  131. data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5474 -0
  132. data/sorbet/rbi/gems/unicode-display_width@3.2.0.rbi +130 -0
  133. data/sorbet/rbi/gems/unicode-emoji@4.2.0.rbi +332 -0
  134. data/sorbet/rbi/gems/uri@1.1.1.rbi +2402 -0
  135. data/sorbet/rbi/gems/useragent@0.16.11.rbi +9 -0
  136. data/sorbet/rbi/gems/websocket-driver@0.8.2.rbi +9 -0
  137. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +9 -0
  138. data/sorbet/rbi/gems/zeitwerk@2.8.2.rbi +9 -0
  139. data/sorbet/rbi/shims/gems/parser.rbi +12 -0
  140. data/sorbet/rbi/shims/gems/rails.rbi +55 -0
  141. data/sorbet/rbi/shims/gems/refract.rbi +13 -0
  142. data/sorbet/rbi/shims/gems/shoulda-context.rbi +16 -0
  143. data/sorbet/tapioca/compilers/phlex_controller.rb +80 -0
  144. data/sorbet/tapioca/config.yml +26 -0
  145. data/sorbet/tapioca/extensions/load_gem.rb +1 -0
  146. data/sorbet/tapioca/require.rb +4 -0
  147. metadata +266 -0
@@ -0,0 +1,75 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `securerandom` gem.
5
+ # Please instead update this file by running `bin/tapioca gem securerandom`.
6
+
7
+
8
+ # == Secure random number generator interface.
9
+ #
10
+ # This library is an interface to secure random number generators which are
11
+ # suitable for generating session keys in HTTP cookies, etc.
12
+ #
13
+ # You can use this library in your application by requiring it:
14
+ #
15
+ # require 'securerandom'
16
+ #
17
+ # It supports the following secure random number generators:
18
+ #
19
+ # * openssl
20
+ # * /dev/urandom
21
+ # * Win32
22
+ #
23
+ # SecureRandom is extended by the Random::Formatter module which
24
+ # defines the following methods:
25
+ #
26
+ # * alphanumeric
27
+ # * base64
28
+ # * choose
29
+ # * gen_random
30
+ # * hex
31
+ # * rand
32
+ # * random_bytes
33
+ # * random_number
34
+ # * urlsafe_base64
35
+ # * uuid
36
+ #
37
+ # These methods are usable as class methods of SecureRandom such as
38
+ # +SecureRandom.hex+.
39
+ #
40
+ # If a secure random number generator is not available,
41
+ # +NotImplementedError+ is raised.
42
+ #
43
+ # pkg:gem/securerandom#lib/securerandom.rb:41
44
+ module SecureRandom
45
+ extend ::Random::Formatter
46
+
47
+ class << self
48
+ # Returns a random binary string containing +size+ bytes.
49
+ #
50
+ # See Random.bytes
51
+ #
52
+ # pkg:gem/securerandom#lib/securerandom.rb:50
53
+ def bytes(n); end
54
+
55
+ # pkg:gem/securerandom#lib/securerandom.rb:84
56
+ def gen_random(n); end
57
+
58
+ private
59
+
60
+ # Implementation using OpenSSL
61
+ #
62
+ # pkg:gem/securerandom#lib/securerandom.rb:65
63
+ def gen_random_openssl(n); end
64
+
65
+ # Implementation using system random device
66
+ #
67
+ # pkg:gem/securerandom#lib/securerandom.rb:70
68
+ def gen_random_urandom(n); end
69
+ end
70
+ end
71
+
72
+ # The version
73
+ #
74
+ # pkg:gem/securerandom#lib/securerandom.rb:44
75
+ SecureRandom::VERSION = T.let(T.unsafe(nil), String)
@@ -0,0 +1,544 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `shoulda-context` gem.
5
+ # Please instead update this file by running `bin/tapioca gem shoulda-context`.
6
+
7
+
8
+ class Minitest::Test < ::Minitest::Runnable
9
+ include ::Shoulda::Context::DSL
10
+ include ::Shoulda::Context::Assertions
11
+ include ::Shoulda::Context::DSL::InstanceMethods
12
+ extend ::Shoulda::Context::DSL::ClassMethods
13
+ end
14
+
15
+ # Stolen straight from ActiveSupport
16
+ #
17
+ # pkg:gem/shoulda-context#lib/shoulda/context/proc_extensions.rb:3
18
+ class Proc
19
+ # pkg:gem/shoulda-context#lib/shoulda/context/proc_extensions.rb:4
20
+ def bind(object); end
21
+ end
22
+
23
+ # pkg:gem/shoulda-context#lib/shoulda/context/autoload_macros.rb:1
24
+ module Shoulda
25
+ class << self
26
+ # Call autoload_macros when you want to load test macros automatically in a non-Rails
27
+ # project (it's done automatically for Rails projects).
28
+ # You don't need to specify ROOT/test/shoulda_macros explicitly. Your custom macros
29
+ # are loaded automatically when you call autoload_macros.
30
+ #
31
+ # The first argument is the path to you application's root directory.
32
+ # All following arguments are directories relative to your root, which contain
33
+ # shoulda_macros subdirectories. These directories support the same kinds of globs as the
34
+ # Dir class.
35
+ #
36
+ # Basic usage (from a test_helper):
37
+ # Shoulda.autoload_macros(File.dirname(__FILE__) + '/..')
38
+ # will load everything in
39
+ # - your_app/test/shoulda_macros
40
+ #
41
+ # To load vendored macros as well:
42
+ # Shoulda.autoload_macros(APP_ROOT, 'vendor/*')
43
+ # will load everything in
44
+ # - APP_ROOT/vendor/*/shoulda_macros
45
+ # - APP_ROOT/test/shoulda_macros
46
+ #
47
+ # To load macros in an app with a vendor directory laid out like Rails':
48
+ # Shoulda.autoload_macros(APP_ROOT, 'vendor/{plugins,gems}/*')
49
+ # or
50
+ # Shoulda.autoload_macros(APP_ROOT, 'vendor/plugins/*', 'vendor/gems/*')
51
+ # will load everything in
52
+ # - APP_ROOT/vendor/plugins/*/shoulda_macros
53
+ # - APP_ROOT/vendor/gems/*/shoulda_macros
54
+ # - APP_ROOT/test/shoulda_macros
55
+ #
56
+ # If you prefer to stick testing dependencies away from your production dependencies:
57
+ # Shoulda.autoload_macros(APP_ROOT, 'vendor/*', 'test/vendor/*')
58
+ # will load everything in
59
+ # - APP_ROOT/vendor/*/shoulda_macros
60
+ # - APP_ROOT/test/vendor/*/shoulda_macros
61
+ # - APP_ROOT/test/shoulda_macros
62
+ #
63
+ # pkg:gem/shoulda-context#lib/shoulda/context/autoload_macros.rb:38
64
+ def autoload_macros(root, *dirs); end
65
+ end
66
+ end
67
+
68
+ # pkg:gem/shoulda-context#lib/shoulda/context/configuration.rb:2
69
+ module Shoulda::Context
70
+ class << self
71
+ # pkg:gem/shoulda-context#lib/shoulda/context/world.rb:13
72
+ def add_context(context); end
73
+
74
+ # pkg:gem/shoulda-context#lib/shoulda/context/configuration.rb:3
75
+ def configure; end
76
+
77
+ # pkg:gem/shoulda-context#lib/shoulda/context/world.rb:4
78
+ def contexts; end
79
+
80
+ # pkg:gem/shoulda-context#lib/shoulda/context/world.rb:7
81
+ def contexts=(_arg0); end
82
+
83
+ # pkg:gem/shoulda-context#lib/shoulda/context/world.rb:9
84
+ def current_context; end
85
+
86
+ # pkg:gem/shoulda-context#lib/shoulda/context/configuration.rb:13
87
+ def extend(mod); end
88
+
89
+ # pkg:gem/shoulda-context#lib/shoulda/context/configuration.rb:7
90
+ def include(mod); end
91
+
92
+ # pkg:gem/shoulda-context#lib/shoulda/context/world.rb:17
93
+ def remove_context; end
94
+
95
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:29
96
+ def test_framework_test_cases; end
97
+ end
98
+ end
99
+
100
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:3
101
+ module Shoulda::Context::Assertions
102
+ # Asserts that the given matcher returns true when +target+ is passed to
103
+ # #matches?
104
+ #
105
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:50
106
+ def assert_accepts(matcher, target, options = T.unsafe(nil)); end
107
+
108
+ # Asserts that the given collection contains item x. If x is a regular expression, ensure that
109
+ # at least one element from the collection matches x. +extra_msg+ is appended to the error message if the assertion fails.
110
+ #
111
+ # assert_contains(['a', '1'], /\d/) => passes
112
+ # assert_contains(['a', '1'], 'a') => passes
113
+ # assert_contains(['a', '1'], /not there/) => fails
114
+ #
115
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:24
116
+ def assert_contains(collection, x, extra_msg = T.unsafe(nil)); end
117
+
118
+ # Asserts that the given collection does not contain item x. If x is a regular expression, ensure that
119
+ # none of the elements from the collection match x.
120
+ #
121
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:37
122
+ def assert_does_not_contain(collection, x, extra_msg = T.unsafe(nil)); end
123
+
124
+ # Asserts that the given matcher returns true when +target+ is passed to
125
+ # #does_not_match? or false when +target+ is passed to #matches? if
126
+ # #does_not_match? is not implemented
127
+ #
128
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:68
129
+ def assert_rejects(matcher, target, options = T.unsafe(nil)); end
130
+
131
+ # Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered.
132
+ #
133
+ # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes)
134
+ #
135
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:7
136
+ def assert_same_elements(a1, a2, msg = T.unsafe(nil)); end
137
+
138
+ # pkg:gem/shoulda-context#lib/shoulda/context/assertions.rb:90
139
+ def safe_assert_block(message = T.unsafe(nil), &block); end
140
+ end
141
+
142
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:3
143
+ class Shoulda::Context::Context
144
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:19
145
+ def initialize(name, parent, &blk); end
146
+
147
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:93
148
+ def am_subcontext?; end
149
+
150
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:190
151
+ def build; end
152
+
153
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:142
154
+ def build_test_name_from(should); end
155
+
156
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:47
157
+ def context(name, &blk); end
158
+
159
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:107
160
+ def create_test_from_should_hash(should); end
161
+
162
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:88
163
+ def full_name; end
164
+
165
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:38
166
+ def merge_block(&blk); end
167
+
168
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:208
169
+ def method_missing(method, *args, &blk); end
170
+
171
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:4
172
+ def name; end
173
+
174
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:4
175
+ def name=(_arg0); end
176
+
177
+ # my name
178
+ #
179
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:5
180
+ def parent; end
181
+
182
+ # my name
183
+ #
184
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:5
185
+ def parent=(_arg0); end
186
+
187
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:183
188
+ def print_should_eventuallys; end
189
+
190
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:151
191
+ def run_all_setup_blocks(binding); end
192
+
193
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:171
194
+ def run_all_teardown_blocks(binding); end
195
+
196
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:160
197
+ def run_current_setup_blocks(binding); end
198
+
199
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:156
200
+ def run_parent_setup_blocks(binding); end
201
+
202
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:51
203
+ def setup(&blk); end
204
+
205
+ # array of contexts nested under myself
206
+ #
207
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:7
208
+ def setup_blocks; end
209
+
210
+ # array of contexts nested under myself
211
+ #
212
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:7
213
+ def setup_blocks=(_arg0); end
214
+
215
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:59
216
+ def should(name_or_matcher, options = T.unsafe(nil), &blk); end
217
+
218
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:80
219
+ def should_eventually(name, &blk); end
220
+
221
+ # array of hashes representing the should statements
222
+ #
223
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:10
224
+ def should_eventuallys; end
225
+
226
+ # array of hashes representing the should statements
227
+ #
228
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:10
229
+ def should_eventuallys=(_arg0); end
230
+
231
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:74
232
+ def should_not(matcher); end
233
+
234
+ # blocks given via teardown methods
235
+ #
236
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:9
237
+ def shoulds; end
238
+
239
+ # blocks given via teardown methods
240
+ #
241
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:9
242
+ def shoulds=(_arg0); end
243
+
244
+ # may be another context, or the original test::unit class.
245
+ #
246
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:6
247
+ def subcontexts; end
248
+
249
+ # may be another context, or the original test::unit class.
250
+ #
251
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:6
252
+ def subcontexts=(_arg0); end
253
+
254
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:84
255
+ def subject(&block); end
256
+
257
+ # accessor with cache
258
+ #
259
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:13
260
+ def subject_block; end
261
+
262
+ # accessor with cache
263
+ #
264
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:17
265
+ def subject_block=(_arg0); end
266
+
267
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:55
268
+ def teardown(&blk); end
269
+
270
+ # blocks given via setup methods
271
+ #
272
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:8
273
+ def teardown_blocks; end
274
+
275
+ # blocks given via setup methods
276
+ #
277
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:8
278
+ def teardown_blocks=(_arg0); end
279
+
280
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:101
281
+ def test_methods; end
282
+
283
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:200
284
+ def test_name_prefix; end
285
+
286
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:97
287
+ def test_unit_class; end
288
+ end
289
+
290
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:5
291
+ module Shoulda::Context::DSL
292
+ include ::Shoulda::Context::Assertions
293
+ include ::Shoulda::Context::DSL::InstanceMethods
294
+
295
+ mixes_in_class_methods ::Shoulda::Context::DSL::ClassMethods
296
+
297
+ class << self
298
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:6
299
+ def included(base); end
300
+ end
301
+ end
302
+
303
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:14
304
+ module Shoulda::Context::DSL::ClassMethods
305
+ # == Before statements
306
+ #
307
+ # Before statements are should statements that run before the current
308
+ # context's setup. These are especially useful when setting expectations.
309
+ #
310
+ # === Example:
311
+ #
312
+ # class UserControllerTest < Test::Unit::TestCase
313
+ # context "the index action" do
314
+ # setup do
315
+ # @users = [Factory(:user)]
316
+ # User.stubs(:find).returns(@users)
317
+ # end
318
+ #
319
+ # context "on GET" do
320
+ # setup { get :index }
321
+ #
322
+ # should respond_with(:success)
323
+ #
324
+ # # runs before "get :index"
325
+ # before_should "find all users" do
326
+ # User.expects(:find).with(:all).returns(@users)
327
+ # end
328
+ # end
329
+ # end
330
+ # end
331
+ #
332
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:121
333
+ def before_should(name, &blk); end
334
+
335
+ # == Contexts
336
+ #
337
+ # A context block groups should statements under a common set of setup/teardown methods.
338
+ # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability
339
+ # and readability of your test code.
340
+ #
341
+ # A context block can contain setup, should, should_eventually, and teardown blocks.
342
+ #
343
+ # class UserTest < Test::Unit::TestCase
344
+ # context "A User instance" do
345
+ # setup do
346
+ # @user = User.find(:first)
347
+ # end
348
+ #
349
+ # should "return its full name"
350
+ # assert_equal 'John Doe', @user.full_name
351
+ # end
352
+ # end
353
+ # end
354
+ #
355
+ # This code will produce the method <tt>"test: A User instance should return its full name. "</tt>.
356
+ #
357
+ # Contexts may be nested. Nested contexts run their setup blocks from out to in before each
358
+ # should statement. They then run their teardown blocks from in to out after each should statement.
359
+ #
360
+ # class UserTest < Test::Unit::TestCase
361
+ # context "A User instance" do
362
+ # setup do
363
+ # @user = User.find(:first)
364
+ # end
365
+ #
366
+ # should "return its full name"
367
+ # assert_equal 'John Doe', @user.full_name
368
+ # end
369
+ #
370
+ # context "with a profile" do
371
+ # setup do
372
+ # @user.profile = Profile.find(:first)
373
+ # end
374
+ #
375
+ # should "return true when sent :has_profile?"
376
+ # assert @user.has_profile?
377
+ # end
378
+ # end
379
+ # end
380
+ # end
381
+ #
382
+ # This code will produce the following methods
383
+ # * <tt>"test: A User instance should return its full name. "</tt>
384
+ # * <tt>"test: A User instance with a profile should return true when sent :has_profile?. "</tt>
385
+ #
386
+ # <b>Just like should statements, a context block can exist next to normal <tt>def test_the_old_way; end</tt>
387
+ # tests</b>. This means you do not have to fully commit to the context/should syntax in a test file.
388
+ #
389
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:188
390
+ def context(name, &blk); end
391
+
392
+ # Returns the class being tested, as determined by the test class name.
393
+ #
394
+ # class UserTest; described_type; end
395
+ # # => User
396
+ #
397
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:201
398
+ def described_type; end
399
+
400
+ # == Should statements
401
+ #
402
+ # Should statements are just syntactic sugar over normal Test::Unit test
403
+ # methods. A should block contains all the normal code and assertions
404
+ # you're used to seeing, with the added benefit that they can be wrapped
405
+ # inside context blocks (see below).
406
+ #
407
+ # === Example:
408
+ #
409
+ # class UserTest < Test::Unit::TestCase
410
+ #
411
+ # def setup
412
+ # @user = User.new("John", "Doe")
413
+ # end
414
+ #
415
+ # should "return its full name"
416
+ # assert_equal 'John Doe', @user.full_name
417
+ # end
418
+ #
419
+ # end
420
+ #
421
+ # ...will produce the following test:
422
+ # * <tt>"test: User should return its full name. "</tt>
423
+ #
424
+ # Note: The part before <tt>should</tt> in the test name is gleamed from the name of the Test::Unit class.
425
+ #
426
+ # Should statements can also take a Proc as a <tt>:before </tt>option. This proc runs after any
427
+ # parent context's setups but before the current context's setup.
428
+ #
429
+ # === Example:
430
+ #
431
+ # context "Some context" do
432
+ # setup { puts("I run after the :before proc") }
433
+ #
434
+ # should "run a :before proc", :before => lambda { puts("I run before the setup") } do
435
+ # assert true
436
+ # end
437
+ # end
438
+ #
439
+ # Should statements can also wrap matchers, making virtually any matcher
440
+ # usable in a macro style. The matcher's description is used to generate a
441
+ # test name and failure message, and the test will pass if the matcher
442
+ # matches the subject.
443
+ #
444
+ # === Example:
445
+ #
446
+ # should validate_presence_of(:first_name).with_message(/gotta be there/)
447
+ #
448
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:64
449
+ def should(name_or_matcher, options = T.unsafe(nil), &blk); end
450
+
451
+ # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output.
452
+ #
453
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:126
454
+ def should_eventually(name, options = T.unsafe(nil), &blk); end
455
+
456
+ # Allows negative tests using matchers. The matcher's description is used
457
+ # to generate a test name and negative failure message, and the test will
458
+ # pass unless the matcher matches the subject.
459
+ #
460
+ # === Example:
461
+ #
462
+ # should_not set_the_flash
463
+ #
464
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:83
465
+ def should_not(matcher); end
466
+
467
+ # Sets the return value of the subject instance method:
468
+ #
469
+ # class UserTest < Test::Unit::TestCase
470
+ # subject { User.first }
471
+ #
472
+ # # uses the existing user
473
+ # should validate_uniqueness_of(:email)
474
+ # end
475
+ #
476
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:218
477
+ def subject(&block); end
478
+
479
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:222
480
+ def subject_block; end
481
+ end
482
+
483
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:227
484
+ module Shoulda::Context::DSL::InstanceMethods
485
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:255
486
+ def get_instance_of(object_or_klass); end
487
+
488
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:263
489
+ def instance_variable_name_for(klass); end
490
+
491
+ # Returns an instance of the class under test.
492
+ #
493
+ # class UserTest
494
+ # should "be a user" do
495
+ # assert_kind_of User, subject # passes
496
+ # end
497
+ # end
498
+ #
499
+ # The subject can be explicitly set using the subject class method:
500
+ #
501
+ # class UserTest
502
+ # subject { User.first }
503
+ # should "be an existing user" do
504
+ # assert !subject.new_record? # uses the first user
505
+ # end
506
+ # end
507
+ #
508
+ # The subject is used by all macros that require an instance of the class
509
+ # being tested.
510
+ #
511
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:247
512
+ def subject; end
513
+
514
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:251
515
+ def subject_block; end
516
+
517
+ private
518
+
519
+ # pkg:gem/shoulda-context#lib/shoulda/context/dsl.rb:269
520
+ def construct_subject; end
521
+ end
522
+
523
+ # pkg:gem/shoulda-context#lib/shoulda/context/context.rb:213
524
+ class Shoulda::Context::DuplicateTestError < ::RuntimeError; end
525
+
526
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:3
527
+ module Shoulda::Context::TestFrameworkDetection
528
+ class << self
529
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:18
530
+ def detected_test_framework_test_cases; end
531
+
532
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:4
533
+ def possible_test_frameworks; end
534
+
535
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:12
536
+ def resolve_framework(future_framework); end
537
+
538
+ # pkg:gem/shoulda-context#lib/shoulda/context/test_framework_detection.rb:24
539
+ def test_framework_test_cases; end
540
+ end
541
+ end
542
+
543
+ # pkg:gem/shoulda-context#lib/shoulda/context/version.rb:3
544
+ Shoulda::Context::VERSION = T.let(T.unsafe(nil), String)