diff --git a/source/documentation/7.0/rspec-rails/RSpec.html b/source/documentation/7.0/rspec-rails/RSpec.html index 1957d269a..0f97c737f 100644 --- a/source/documentation/7.0/rspec-rails/RSpec.html +++ b/source/documentation/7.0/rspec-rails/RSpec.html @@ -62,7 +62,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails.html b/source/documentation/7.0/rspec-rails/RSpec/Rails.html index b3a3347bf..ed302d5ee 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails.html @@ -302,7 +302,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html index 3601eeec3..683533644 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html @@ -71,7 +71,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup.html index fc857b666..8d461d764 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup.html @@ -237,7 +237,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html index 7905a7ab1..e45dc507d 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html @@ -61,7 +61,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Configuration.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Configuration.html index 2a0423d62..44ccff56d 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Configuration.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Configuration.html @@ -71,7 +71,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup.html index 37ff078ea..cdb47bef2 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup.html @@ -262,7 +262,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html index 2408a7908..df5dbdde9 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html @@ -268,7 +268,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/FeatureExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/FeatureExampleGroup.html index 03b7bc6af..43455b688 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/FeatureExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/FeatureExampleGroup.html @@ -135,7 +135,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/HelperExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/HelperExampleGroup.html index 13b5ac85b..585d408ae 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/HelperExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/HelperExampleGroup.html @@ -118,7 +118,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/JobExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/JobExampleGroup.html index 136a0f89d..9aa238a44 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/JobExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/JobExampleGroup.html @@ -69,7 +69,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailboxExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailboxExampleGroup.html index 2beec2308..081738729 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailboxExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailboxExampleGroup.html @@ -240,7 +240,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup.html index 0590aaacc..b1b0e5572 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup.html @@ -72,7 +72,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html index 371abb04e..45c9e0160 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html @@ -101,7 +101,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers.html index e024b6903..f6ef021d7 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers.html @@ -754,7 +754,7 @@

More precise expectation with a

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable.html index 0b5de1688..51989990b 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable.html @@ -69,7 +69,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html index e19f6b494..e57e2aaff 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html @@ -263,7 +263,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html index b693c3121..592e7e257 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html @@ -64,7 +64,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html index d8c0208eb..2104146af 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html @@ -64,7 +64,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html index 4cd5b41a1..02982fc87 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html @@ -442,7 +442,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html index bc8c86bcd..d4304bbba 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html @@ -169,7 +169,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BeANew.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BeANew.html index 7b17a1387..c3ddc7498 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BeANew.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/BeANew.html @@ -134,7 +134,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html index 7ea228d92..f70f6a111 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html @@ -303,7 +303,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html index 96d69bb98..392718a81 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html @@ -433,7 +433,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html index 8dc2f2fb5..1ec8fa659 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html @@ -364,7 +364,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html index 9d724f006..8a706c1ea 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html @@ -369,7 +369,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html index 47c60eb36..0c89883fb 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html @@ -109,7 +109,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html index 83fd16780..62a3a009d 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html @@ -113,7 +113,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html index 0e16fd2d9..32b7ca303 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html @@ -169,7 +169,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html index 567ce03dc..08500f67f 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html @@ -331,7 +331,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/SendEmail.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/SendEmail.html index 87073faa6..8f3376c0e 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/SendEmail.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Matchers/SendEmail.html @@ -381,7 +381,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ModelExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ModelExampleGroup.html index 8064719a7..d792e1e5b 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ModelExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ModelExampleGroup.html @@ -68,7 +68,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/RailsExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/RailsExampleGroup.html index 0a67f0ef4..61c368f3f 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/RailsExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/RailsExampleGroup.html @@ -71,7 +71,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Railtie.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Railtie.html index 82b29dfb8..ed2525b31 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Railtie.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Railtie.html @@ -71,7 +71,7 @@

Overview

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/RequestExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/RequestExampleGroup.html index 2e9134db6..9e597d988 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/RequestExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/RequestExampleGroup.html @@ -113,7 +113,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup.html index 7206f84c1..f4e4680ad 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup.html @@ -108,7 +108,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html index c73055748..99c4e8978 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html @@ -116,7 +116,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/SystemExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/SystemExampleGroup.html index 376568d2f..6be6b11b7 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/SystemExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/SystemExampleGroup.html @@ -192,7 +192,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/Version.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/Version.html index 75ce198d4..1fe36248b 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/Version.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/Version.html @@ -71,11 +71,11 @@

-
'7.0.1'
+
'7.0.2'
diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewAssigns.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewAssigns.html index 3a7f91ac7..94a49c9e8 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewAssigns.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewAssigns.html @@ -144,7 +144,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup.html index e1d34e53b..eddeec790 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup.html @@ -75,7 +75,7 @@

Methods included from #assign, #view_assigns

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html index cf9e3478d..b481efc0d 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html @@ -331,7 +331,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewPathBuilder.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewPathBuilder.html index 3bf6f4ec9..9f4acee5b 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewPathBuilder.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewPathBuilder.html @@ -164,7 +164,7 @@

Examples:

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering.html index bfdd1cf2e..f0fa3c11e 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering.html @@ -162,7 +162,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html index ae49f2dae..7ae79aaed 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html @@ -156,7 +156,7 @@

diff --git a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewSpecMethods.html b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewSpecMethods.html index ed9ffb6b7..aa2681f43 100644 --- a/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewSpecMethods.html +++ b/source/documentation/7.0/rspec-rails/RSpec/Rails/ViewSpecMethods.html @@ -205,7 +205,7 @@

diff --git a/source/documentation/7.0/rspec-rails/_index.html b/source/documentation/7.0/rspec-rails/_index.html index 3c7e7493f..714769441 100644 --- a/source/documentation/7.0/rspec-rails/_index.html +++ b/source/documentation/7.0/rspec-rails/_index.html @@ -312,7 +312,7 @@

Namespace Listing A-Z

diff --git a/source/documentation/7.0/rspec-rails/file.Capybara.html b/source/documentation/7.0/rspec-rails/file.Capybara.html index 7e87b6fc8..04ca489ac 100644 --- a/source/documentation/7.0/rspec-rails/file.Capybara.html +++ b/source/documentation/7.0/rspec-rails/file.Capybara.html @@ -64,7 +64,7 @@

Upgrading to Capybara-3.x

Consult the official Upgrading from Capybara 2.x to 3.x guide.

diff --git a/source/documentation/7.0/rspec-rails/file.Changelog.html b/source/documentation/7.0/rspec-rails/file.Changelog.html index 5fa47a48b..a6340e63d 100644 --- a/source/documentation/7.0/rspec-rails/file.Changelog.html +++ b/source/documentation/7.0/rspec-rails/file.Changelog.html @@ -41,7 +41,9 @@

Development

-

Full Changelog

+

Full Changelog

+

7.0.2 / 2024-11-09

+

Full Changelog

Bug Fixes:

diff --git a/source/documentation/7.0/rspec-rails/file.LICENSE.html b/source/documentation/7.0/rspec-rails/file.LICENSE.html index 4fe1cd5f5..23d6a73b5 100644 --- a/source/documentation/7.0/rspec-rails/file.LICENSE.html +++ b/source/documentation/7.0/rspec-rails/file.LICENSE.html @@ -64,7 +64,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff --git a/source/documentation/7.0/rspec-rails/file.README.html b/source/documentation/7.0/rspec-rails/file.README.html index 66658e7f4..811dc397b 100644 --- a/source/documentation/7.0/rspec-rails/file.README.html +++ b/source/documentation/7.0/rspec-rails/file.README.html @@ -382,7 +382,7 @@

Defined Under Namespace

diff --git a/source/documentation/7.1/rspec-rails/RSpec.html b/source/documentation/7.1/rspec-rails/RSpec.html new file mode 100644 index 000000000..49516c4ed --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec.html @@ -0,0 +1,71 @@ + + + + + + + Module: RSpec + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec +

+
+
+
Defined in:
+
lib/rspec-rails.rb,
+ lib/rspec/rails/version.rb,
lib/rspec/rails/adapters.rb,
lib/rspec/rails/matchers.rb,
lib/rspec/rails/view_assigns.rb,
lib/rspec/rails/active_record.rb,
lib/rspec/rails/configuration.rb,
lib/rspec/rails/feature_check.rb,
lib/rspec/rails/view_rendering.rb,
lib/rspec/rails/fixture_support.rb,
lib/rspec/rails/matchers/be_a_new.rb,
lib/rspec/rails/matchers/be_valid.rb,
lib/rspec/rails/view_path_builder.rb,
lib/rspec/rails/view_spec_methods.rb,
lib/rspec/rails/matchers/active_job.rb,
lib/rspec/rails/matchers/send_email.rb,
lib/rspec/rails/file_fixture_support.rb,
lib/rspec/rails/matchers/redirect_to.rb,
lib/rspec/rails/matchers/action_cable.rb,
lib/rspec/rails/matchers/base_matcher.rb,
lib/rspec/rails/matchers/be_new_record.rb,
lib/rspec/rails/matchers/have_rendered.rb,
lib/rspec/rails/matchers/action_mailbox.rb,
lib/rspec/rails/example/job_example_group.rb,
lib/rspec/rails/example/job_example_group.rb,
lib/rspec/rails/matchers/have_http_status.rb,
lib/rspec/rails/matchers/routing_matchers.rb,
lib/rspec/rails/example/view_example_group.rb,
lib/rspec/rails/example/model_example_group.rb,
lib/rspec/rails/example/rails_example_group.rb,
lib/rspec/rails/fixture_file_upload_support.rb,
lib/rspec/rails/matchers/have_enqueued_mail.rb,
lib/rspec/rails/example/helper_example_group.rb,
lib/rspec/rails/example/mailer_example_group.rb,
lib/rspec/rails/example/mailer_example_group.rb,
lib/rspec/rails/example/system_example_group.rb,
lib/rspec/rails/example/channel_example_group.rb,
lib/rspec/rails/example/channel_example_group.rb,
lib/rspec/rails/example/feature_example_group.rb,
lib/rspec/rails/example/mailbox_example_group.rb,
lib/rspec/rails/example/request_example_group.rb,
lib/rspec/rails/example/routing_example_group.rb,
lib/rspec/rails/example/controller_example_group.rb,
lib/rspec/rails/matchers/action_cable/have_streams.rb,
lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb
+
+
+
+

Overview

+
+

rubocop: disable Metrics/ClassLength

+
+
+
+

Defined Under Namespace

+

+ Modules: Rails +

+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails.html b/source/documentation/7.1/rspec-rails/RSpec/Rails.html new file mode 100644 index 000000000..9703a670b --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails.html @@ -0,0 +1,311 @@ + + + + + + + Module: RSpec::Rails + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails +

+
+
+
Defined in:
+
lib/rspec-rails.rb,
+ lib/rspec/rails/version.rb,
lib/rspec/rails/adapters.rb,
lib/rspec/rails/matchers.rb,
lib/rspec/rails/view_assigns.rb,
lib/rspec/rails/active_record.rb,
lib/rspec/rails/configuration.rb,
lib/rspec/rails/feature_check.rb,
lib/rspec/rails/view_rendering.rb,
lib/rspec/rails/fixture_support.rb,
lib/rspec/rails/matchers/be_a_new.rb,
lib/rspec/rails/matchers/be_valid.rb,
lib/rspec/rails/view_path_builder.rb,
lib/rspec/rails/view_spec_methods.rb,
lib/rspec/rails/matchers/active_job.rb,
lib/rspec/rails/matchers/send_email.rb,
lib/rspec/rails/file_fixture_support.rb,
lib/rspec/rails/matchers/redirect_to.rb,
lib/rspec/rails/matchers/action_cable.rb,
lib/rspec/rails/matchers/base_matcher.rb,
lib/rspec/rails/matchers/be_new_record.rb,
lib/rspec/rails/matchers/have_rendered.rb,
lib/rspec/rails/matchers/action_mailbox.rb,
lib/rspec/rails/example/job_example_group.rb,
lib/rspec/rails/example/job_example_group.rb,
lib/rspec/rails/matchers/have_http_status.rb,
lib/rspec/rails/matchers/routing_matchers.rb,
lib/rspec/rails/example/view_example_group.rb,
lib/rspec/rails/example/model_example_group.rb,
lib/rspec/rails/example/rails_example_group.rb,
lib/rspec/rails/fixture_file_upload_support.rb,
lib/rspec/rails/matchers/have_enqueued_mail.rb,
lib/rspec/rails/example/helper_example_group.rb,
lib/rspec/rails/example/mailer_example_group.rb,
lib/rspec/rails/example/mailer_example_group.rb,
lib/rspec/rails/example/system_example_group.rb,
lib/rspec/rails/example/channel_example_group.rb,
lib/rspec/rails/example/channel_example_group.rb,
lib/rspec/rails/example/feature_example_group.rb,
lib/rspec/rails/example/mailbox_example_group.rb,
lib/rspec/rails/example/request_example_group.rb,
lib/rspec/rails/example/routing_example_group.rb,
lib/rspec/rails/example/controller_example_group.rb,
lib/rspec/rails/matchers/action_cable/have_streams.rb,
lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb
+
+
+
+

Overview

+
+

Namespace for rspec-rails code.

+
+
+
+

Defined Under Namespace

+

+ Modules: ChannelExampleGroup, ControllerExampleGroup, FeatureExampleGroup, HelperExampleGroup, JobExampleGroup, MailboxExampleGroup, MailerExampleGroup, Matchers, ModelExampleGroup, RailsExampleGroup, RequestExampleGroup, RoutingExampleGroup, SystemExampleGroup, Version, ViewAssigns, ViewExampleGroup, ViewRendering, ViewSpecMethods + Classes: ActiveRecordConfiguration, Configuration, Railtie, ViewPathBuilder +

+

+ Constant Summary + collapse +

+
+
Assertions = +
+
+

Constant aliased to either Minitest or TestUnit, depending on what is +loaded.

+
+
+
+
+
+
Minitest::Assertions
+
DIRECTORY_MAPPINGS = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+

Mappings used by infer_spec_type_from_file_location!.

+
+
+
+
+
+
{
+  channel: %w[spec channels],
+  controller: %w[spec controllers],
+  generator: %w[spec generator],
+  helper: %w[spec helpers],
+  job: %w[spec jobs],
+  mailer: %w[spec mailers],
+  model: %w[spec models],
+  request: %w[spec (requests|integration|api)],
+  routing: %w[spec routing],
+  view: %w[spec views],
+  feature: %w[spec features],
+  system: %w[spec system],
+  mailbox: %w[spec mailboxes]
+}
+
+

+ Class Method Summary + collapse +

+ +

+ Instance Method Summary + collapse +

+ +
+

Class Method Details

+
+

+ .add_test_type_configurations(config) ⇒ Object +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Sets up the different example group modules for the different spec types

+
+
+
+
+ + + + +
+
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+
+
# File 'lib/rspec/rails/configuration.rb', line 47
+def self.add_test_type_configurations(config)
+  config.include RSpec::Rails::ControllerExampleGroup, type: :controller
+  config.include RSpec::Rails::HelperExampleGroup,     type: :helper
+  config.include RSpec::Rails::ModelExampleGroup,      type: :model
+  config.include RSpec::Rails::RequestExampleGroup,    type: :request
+  config.include RSpec::Rails::RoutingExampleGroup,    type: :routing
+  config.include RSpec::Rails::ViewExampleGroup,       type: :view
+  config.include RSpec::Rails::FeatureExampleGroup,    type: :feature
+  config.include RSpec::Rails::Matchers
+  config.include RSpec::Rails::SystemExampleGroup, type: :system
+end
+
+
+
+
+

Instance Method Details

+
+

+ #infer_spec_type_from_file_location!Object +

+
+

Automatically tag specs in conventional directories with matching type +metadata so that they have relevant helpers available to them. See +RSpec::Rails::DIRECTORY_MAPPINGS for details on which metadata is +applied to each directory.

+
+
+
+
+ + + + +
+
+
+
+
# File 'lib/rspec/rails/configuration.rb', line 7
+
+
+
+
+

+ #render_views(val) ⇒ Object +

+
+

Enables view rendering for controllers specs.

+
+
+
+
+ + + + +
+
+
+
+
# File 'lib/rspec/rails/configuration.rb', line 18
+
+
+
+
+

+ #render_views=(val) ⇒ Object +

+
+

When set to true, controller specs will render the relevant view as +well. Defaults to false.

+
+
+
+
+ + + + +
+
+
+
+
# File 'lib/rspec/rails/configuration.rb', line 13
+
+
+
+
+

+ #render_views?Object +

+
+

Reader for currently value of render_views setting.

+
+
+
+
+ + + + +
+
+
+
+
# File 'lib/rspec/rails/configuration.rb', line 21
+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html new file mode 100644 index 000000000..5974752cc --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ActiveRecordConfiguration.html @@ -0,0 +1,80 @@ + + + + + + + Class: RSpec::Rails::ActiveRecordConfiguration + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::ActiveRecordConfiguration +

+
+
+
Inherits:
+
+ Object +
    +
  • Object
  • + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/active_record.rb
+
+
+

Overview

+
+

Fake class to document RSpec ActiveRecord configuration options. In practice, +these are dynamically added to the normal RSpec configuration object.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup.html new file mode 100644 index 000000000..71de54e28 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup.html @@ -0,0 +1,246 @@ + + + + + + + Module: RSpec::Rails::ChannelExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ChannelExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionCable::Channel::TestCase::Behavior, ActionCable::Connection::TestCase::Behavior, RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/channel_example_group.rb,
+ lib/rspec/rails/example/channel_example_group.rb
+
+
+
+

Overview

+
+

Container module for channel spec functionality.

+
+
+
+

Defined Under Namespace

+

+ Modules: ClassMethods +

+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #have_rejected_connectionObject +

+
+

Checks that the connection attempt has been rejected.

+
+
+
+
+

Examples:

+
expect { connect }.to have_rejected_connection
+
+
+ + + + +
+
+58
+59
+60
+
+
# File 'lib/rspec/rails/example/channel_example_group.rb', line 58
+def have_rejected_connection
+  raise_error(::ActionCable::Connection::Authorization::UnauthorizedError)
+end
+
+
+
+

+ #have_stream_for(object) ⇒ Object +

+
+

Checks that the channel has been subscribed to a stream for the given model

+
+
+
+
+

Examples:

+
expect(subscription).to have_stream_for(user)
+
+
+ + + + +
+
+86
+87
+88
+89
+
+
# File 'lib/rspec/rails/example/channel_example_group.rb', line 86
+def have_stream_for(object)
+  check_subscribed!
+  RSpec::Rails::Matchers::ActionCable::HaveStream.new(broadcasting_for(object))
+end
+
+
+
+

+ #have_stream_from(stream) ⇒ Object +

+
+

Checks that the channel has been subscribed to the given stream

+
+
+
+
+

Examples:

+
expect(subscription).to have_stream_from("chat_1")
+
+
+ + + + +
+
+76
+77
+78
+79
+80
+
+
# File 'lib/rspec/rails/example/channel_example_group.rb', line 76
+def have_stream_from(stream)
+  check_subscribed!
+  RSpec::Rails::Matchers::ActionCable::HaveStream.new(stream)
+end
+
+
+
+

+ #have_streamsObject +

+
+

Checks that the subscription is subscribed to at least one stream.

+
+
+
+
+

Examples:

+
expect(subscription).to have_streams
+
+
+ + + + +
+
+66
+67
+68
+69
+70
+
+
# File 'lib/rspec/rails/example/channel_example_group.rb', line 66
+def have_streams
+  check_subscribed!
+  RSpec::Rails::Matchers::ActionCable::HaveStream.new
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html new file mode 100644 index 000000000..e22f0c883 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ChannelExampleGroup/ClassMethods.html @@ -0,0 +1,70 @@ + + + + + + + Module: RSpec::Rails::ChannelExampleGroup::ClassMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ChannelExampleGroup::ClassMethods +

+
+
+
Defined in:
+
lib/rspec/rails/example/channel_example_group.rb,
+ lib/rspec/rails/example/channel_example_group.rb
+
+
+
+

Overview

+
+

Class-level DSL for channel specs.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Configuration.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Configuration.html new file mode 100644 index 000000000..56b0a91ea --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Configuration.html @@ -0,0 +1,80 @@ + + + + + + + Class: RSpec::Rails::Configuration + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Configuration +

+
+
+
Inherits:
+
+ Object +
    +
  • Object
  • + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/configuration.rb
+
+
+

Overview

+
+

Fake class to document RSpec Rails configuration options. In practice, +these are dynamically added to the normal RSpec configuration object.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup.html new file mode 100644 index 000000000..f696bb119 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup.html @@ -0,0 +1,271 @@ + + + + + + + Module: RSpec::Rails::ControllerExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ControllerExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionController::TestCase::Behavior, AssertionDelegator.new( + ActionDispatch::Assertions::RoutingAssertions +), Matchers::RedirectTo, Matchers::RenderTemplate, Matchers::RoutingMatchers, RailsExampleGroup, ViewRendering
+
+
+
Defined in:
+
lib/rspec/rails/example/controller_example_group.rb
+
+
+

Overview

+
+

Container module for controller spec functionality.

+
+
+
+

Defined Under Namespace

+

+ Modules: ClassMethods +

+

Instance Attribute Summary collapse

+ +

+ Instance Method Summary + collapse +

+ +

Methods included from Matchers::RoutingMatchers

+

#be_routable, #route_to

+

Methods included from Matchers::RenderTemplate

+

#have_rendered

+

Methods included from Matchers::RedirectTo

+

#redirect_to

+

Methods included from ViewRendering

+

#render_views?

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method +

+
+

+ #method_missing(method, *args, &block) ⇒ Object +

+
+

If method is a named_route, delegates to the RouteSet associated with +this controller.

+
+
+
+
+ + + + +
+
+172
+173
+174
+175
+176
+177
+178
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 172
+def method_missing(method, *args, &block)
+  if route_available?(method)
+    controller.send(method, *args, &block)
+  else
+    super
+  end
+end
+
+
+
+
+

Instance Attribute Details

+ +
+

+ #controllerObject (readonly) +

+
+

Returns the controller object instance under test.

+
+
+
+
+ + + + +
+
+128
+129
+130
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 128
+def controller
+  @controller
+end
+
+
+ +
+

+ #routesObject +

+
+

Returns the Rails routes used for the spec.

+
+
+
+
+ + + + +
+
+132
+133
+134
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 132
+def routes
+  @routes
+end
+
+
+
+
+

Instance Method Details

+
+

+ #bypass_rescueObject +

+
+

Extends the controller with a module that overrides +rescue_with_handler to raise the exception passed to it. Use this to +specify that an action should raise an exception given appropriate +conditions.

+
+
+
+
+

Examples:

+
describe ProfilesController do
+  it "raises a 403 when a non-admin user tries to view another user's profile" do
+    profile = create_profile
+     profile.user
+    expect do
+      bypass_rescue
+      get :show, id: profile.id + 1
+    end.to raise_error(/403 Forbidden/)
+  end
+end
+
+
+ + + + +
+
+166
+167
+168
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 166
+def bypass_rescue
+  controller.extend(BypassRescue)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html new file mode 100644 index 000000000..f0a387aee --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ControllerExampleGroup/ClassMethods.html @@ -0,0 +1,277 @@ + + + + + + + Module: RSpec::Rails::ControllerExampleGroup::ClassMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ControllerExampleGroup::ClassMethods +

+
+
+
Defined in:
+
lib/rspec/rails/example/controller_example_group.rb
+
+
+

Overview

+
+

Class-level DSL for controller specs.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #controller(base_class = nil, &body) ⇒ Object +

+
+
+ Note: +

Due to Ruby 1.8 scoping rules in anonymous subclasses, constants +defined in ApplicationController must be fully qualified (e.g. +ApplicationController::AccessDenied) in the block passed to the +controller method. Any instance methods, filters, etc, that are +defined in ApplicationController, however, are accessible from +within the block.

+
+
+

Supports a simple DSL for specifying behavior of ApplicationController. +Creates an anonymous subclass of ApplicationController and evals the +body in that context. Also sets up implicit routes for this +controller, that are separate from those defined in "config/routes.rb".

+

If you would like to spec a subclass of ApplicationController, call +controller like so:

+
controller(ApplicationControllerSubclass) do
+  # ....
+end
+
+
+
+
+
+

Examples:

+
describe ApplicationController do
+  controller do
+    def index
+      raise ApplicationController::AccessDenied
+    end
+  end
+  describe "handling AccessDenied exceptions" do
+    it "redirects to the /401.html page" do
+      get :index
+      response.should redirect_to("/401.html")
+    end
+  end
+end
+
+
+ + + + +
+
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 61
+def controller(base_class = nil, &body)
+  if RSpec.configuration.infer_base_class_for_anonymous_controllers?
+    base_class ||= controller_class
+  end
+  base_class ||= defined?(ApplicationController) ? ApplicationController : ActionController::Base
+  new_controller_class = Class.new(base_class) do
+    def self.name
+      root_controller = defined?(ApplicationController) ? ApplicationController : ActionController::Base
+      if superclass == root_controller || superclass.abstract?
+        "AnonymousController"
+      else
+        superclass.name
+      end
+    end
+  end
+  new_controller_class.class_exec(&body)
+  (class << self; self; end).__send__(:define_method, :controller_class) { new_controller_class }
+  before do
+    @orig_routes = routes
+    resource_name = if @controller.respond_to?(:controller_name)
+                      @controller.controller_name.to_sym
+                    else
+                      :anonymous
+                    end
+    resource_path = if @controller.respond_to?(:controller_path)
+                      @controller.controller_path
+                    else
+                      resource_name.to_s
+                    end
+    resource_module = resource_path.rpartition('/').first.presence
+    resource_as = 'anonymous_' + resource_path.tr('/', '_')
+    self.routes = ActionDispatch::Routing::RouteSet.new.tap do |r|
+      r.draw do
+        resources resource_name,
+                  as: resource_as,
+                  module: resource_module,
+                  path: resource_path
+      end
+    end
+  end
+  after do
+    self.routes  = @orig_routes
+    @orig_routes = nil
+  end
+end
+
+
+
+

+ #routesObject +

+
+

Specifies the routeset that will be used for the example group. This +is most useful when testing Rails engines.

+
+
+
+
+

Examples:

+
describe MyEngine::PostsController do
+  routes { MyEngine::Engine.routes }
+  # ...
+end
+
+
+ + + + +
+
+119
+120
+121
+122
+123
+
+
# File 'lib/rspec/rails/example/controller_example_group.rb', line 119
+def routes
+  before do
+    self.routes = yield
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/FeatureExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/FeatureExampleGroup.html new file mode 100644 index 000000000..701013394 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/FeatureExampleGroup.html @@ -0,0 +1,144 @@ + + + + + + + Module: RSpec::Rails::FeatureExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::FeatureExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/feature_example_group.rb
+
+
+

Overview

+
+

Container module for routing spec functionality.

+
+
+
+
+

+ Constant Summary + collapse +

+
+
DEFAULT_HOST = +
+
+

Default host to be used in Rails route helpers if none is specified.

+
+
+
+
+
+
"www.example.com"
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #visitObject +

+
+

Shim to check for presence of Capybara. Will delegate if present, raise +if not. We assume here that in most cases visit will be the first +Capybara method called in a spec.

+
+
+
+
+ + + + +
+
+27
+28
+29
+30
+31
+32
+33
+
+
# File 'lib/rspec/rails/example/feature_example_group.rb', line 27
+def visit(*)
+  if defined?(super)
+    super
+  else
+    raise "Capybara not loaded, please add it to your Gemfile:\n\ngem \"capybara\""
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/HelperExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/HelperExampleGroup.html new file mode 100644 index 000000000..316df3310 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/HelperExampleGroup.html @@ -0,0 +1,127 @@ + + + + + + + Module: RSpec::Rails::HelperExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::HelperExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionView::TestCase::Behavior, RailsExampleGroup, ViewAssigns
+
+
+
Defined in:
+
lib/rspec/rails/example/helper_example_group.rb
+
+
+

Overview

+
+

Container module for helper specs.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +

Methods included from ViewAssigns

+

#assign, #view_assigns

+
+

Instance Method Details

+
+

+ #helperObject +

+
+

Returns an instance of ActionView::Base with the helper being specified +mixed in, along with any of the built-in rails helpers.

+
+
+
+
+ + + + +
+
+22
+23
+24
+25
+26
+27
+
+
# File 'lib/rspec/rails/example/helper_example_group.rb', line 22
+def helper
+  _view.tap do |v|
+    v.extend(ApplicationHelper) if defined?(ApplicationHelper)
+    v.assign(view_assigns)
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/JobExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/JobExampleGroup.html new file mode 100644 index 000000000..73a99531b --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/JobExampleGroup.html @@ -0,0 +1,78 @@ + + + + + + + Module: RSpec::Rails::JobExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::JobExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/job_example_group.rb,
+ lib/rspec/rails/example/job_example_group.rb
+
+
+
+

Overview

+
+

Container module for job spec functionality.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/MailboxExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailboxExampleGroup.html new file mode 100644 index 000000000..e337c9f20 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailboxExampleGroup.html @@ -0,0 +1,249 @@ + + + + + + + Module: RSpec::Rails::MailboxExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::MailboxExampleGroup +

+
+
+
Extended by:
+
ActionMailbox::TestHelper, ActiveSupport::Concern
+
+
+
Defined in:
+
lib/rspec/rails/example/mailbox_example_group.rb
+
+
+

Overview

+
+

Container module for mailbox spec functionality.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #have_been_deliveredObject +

+
+

Passes if the inbound email was delivered

+
+
+
+
+

Examples:

+
inbound_email = process(args)
+expect(inbound_email).to have_been_delivered
+
+
+ + + + +
+
+44
+45
+46
+
+
# File 'lib/rspec/rails/example/mailbox_example_group.rb', line 44
+def have_been_delivered
+  satisfy('have been delivered', &:delivered?)
+end
+
+
+
+

+ #have_bouncedObject +

+
+

Passes if the inbound email bounced during processing

+
+
+
+
+

Examples:

+
inbound_email = process(args)
+expect(inbound_email).to have_bounced
+
+
+ + + + +
+
+54
+55
+56
+
+
# File 'lib/rspec/rails/example/mailbox_example_group.rb', line 54
+def have_bounced
+  satisfy('have bounced', &:bounced?)
+end
+
+
+
+

+ #have_failedObject +

+
+

Passes if the inbound email failed to process

+
+
+
+
+

Examples:

+
inbound_email = process(args)
+expect(inbound_email).to have_failed
+
+
+ + + + +
+
+64
+65
+66
+
+
# File 'lib/rspec/rails/example/mailbox_example_group.rb', line 64
+def have_failed
+  satisfy('have failed', &:failed?)
+end
+
+
+
+

+ #process(message) ⇒ ActionMailbox::InboundMessage +

+
+

Process an inbound email message directly, bypassing routing.

+
+
+
+

Parameters:

+
    +
  • + message + (Hash, Mail::Message) + — +

    a mail message or hash of +attributes used to build one

    +
    +
  • +
+

Returns:

+
    +
  • + (ActionMailbox::InboundMessage) +
  • +
+
+ + + + +
+
+73
+74
+75
+76
+77
+
+
# File 'lib/rspec/rails/example/mailbox_example_group.rb', line 73
+def process(message)
+  MailboxExampleGroup.create_inbound_email(message).tap do |mail|
+    self.class.mailbox_class.receive(mail)
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup.html new file mode 100644 index 000000000..6fde0102f --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup.html @@ -0,0 +1,81 @@ + + + + + + + Module: RSpec::Rails::MailerExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::MailerExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionMailer::TestCase::Behavior, RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/mailer_example_group.rb,
+ lib/rspec/rails/example/mailer_example_group.rb
+
+
+
+

Overview

+
+

Container module for mailer spec functionality.

+
+
+
+

Defined Under Namespace

+

+ Modules: ClassMethods +

+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html new file mode 100644 index 000000000..bfcf8331f --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/MailerExampleGroup/ClassMethods.html @@ -0,0 +1,110 @@ + + + + + + + Module: RSpec::Rails::MailerExampleGroup::ClassMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::MailerExampleGroup::ClassMethods +

+
+
+
Defined in:
+
lib/rspec/rails/example/mailer_example_group.rb
+
+
+

Overview

+
+

Class-level DSL for mailer specs.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #mailer_classObject +

+
+

Alias for described_class.

+
+
+
+
+ + + + +
+
+31
+32
+33
+
+
# File 'lib/rspec/rails/example/mailer_example_group.rb', line 31
+def mailer_class
+  described_class
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers.html new file mode 100644 index 000000000..8446aa97f --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers.html @@ -0,0 +1,763 @@ + + + + + + + Module: RSpec::Rails::Matchers + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers +

+
+
+
Extended by:
+
Matchers::DSL
+
+
+
Defined in:
+
lib/rspec/rails/matchers.rb,
+ lib/rspec/rails/matchers/be_a_new.rb,
lib/rspec/rails/matchers/be_valid.rb,
lib/rspec/rails/matchers/active_job.rb,
lib/rspec/rails/matchers/send_email.rb,
lib/rspec/rails/matchers/redirect_to.rb,
lib/rspec/rails/matchers/action_cable.rb,
lib/rspec/rails/matchers/base_matcher.rb,
lib/rspec/rails/matchers/be_new_record.rb,
lib/rspec/rails/matchers/have_rendered.rb,
lib/rspec/rails/matchers/action_mailbox.rb,
lib/rspec/rails/matchers/have_http_status.rb,
lib/rspec/rails/matchers/routing_matchers.rb,
lib/rspec/rails/matchers/have_enqueued_mail.rb,
lib/rspec/rails/matchers/action_cable/have_streams.rb,
lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb
+
+
+
+

Overview

+
+

Container module for Rails specific matchers.

+
+
+
+

Defined Under Namespace

+

+ Modules: ActionCable, ActionMailbox, ActiveJob, HaveHttpStatus, RedirectTo, RenderTemplate, RoutingMatchers + Classes: BaseMatcher, BeANew, SendEmail +

+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #be_a_new(model_class) ⇒ Object +

+
+

Passes if actual is an instance of model_class and returns true for +new_record?. Typically used to specify instance variables assigned to +views by controller actions

+

Use the with method to specify the specific attributes to match on the +new record.

+
+
+
+
+

Examples:

+
get :new
+assigns(:thing).should be_a_new(Thing)
+post :create, :thing => { :name => "Illegal Value" }
+assigns(:thing).should be_a_new(Thing).with(:name => nil)
+
+
+ + + + +
+
+78
+79
+80
+
+
# File 'lib/rspec/rails/matchers/be_a_new.rb', line 78
+def be_a_new(model_class)
+  BeANew.new(model_class)
+end
+
+
+
+

+ #be_new_recordObject +

+
+

Passes if actual returns true for new_record?.

+
+
+
+
+

Examples:

+
get :new
+expect(assigns(:thing)).to be_new_record
+
+
+ + + + +
+
+25
+26
+27
+
+
# File 'lib/rspec/rails/matchers/be_new_record.rb', line 25
+def be_new_record
+  BeANewRecord.new
+end
+
+
+
+

+ #be_valid(*args) ⇒ Object +

+
+

Passes if the given model instance's valid? method is true, meaning +all of the ActiveModel::Validations passed and no errors exist. If a +message is not given, a default message is shown listing each error.

+
+
+
+
+

Examples:

+
thing = Thing.new
+expect(thing).to be_valid
+
+
+ + + + +
+
+44
+45
+46
+
+
# File 'lib/rspec/rails/matchers/be_valid.rb', line 44
+def be_valid(*args)
+  BeValid.new(*args)
+end
+
+
+
+

+ #have_been_enqueuedObject +

+
+

Passes if a job has been enqueued. May chain at_least, at_most or exactly to specify a number of times.

+
+
+
+
+

Examples:

+
before { ActiveJob::Base.queue_adapter.enqueued_jobs.clear }
+HeavyLiftingJob.perform_later
+expect(HeavyLiftingJob).to have_been_enqueued
+HelloJob.perform_later
+HeavyLiftingJob.perform_later
+expect(HeavyLiftingJob).to have_been_enqueued.exactly(:once)
+3.times { HelloJob.perform_later }
+expect(HelloJob).to have_been_enqueued.at_least(2).times
+HelloJob.perform_later
+expect(HelloJob).to enqueue_job(HelloJob).at_most(:twice)
+HelloJob.perform_later
+HeavyLiftingJob.perform_later
+expect(HelloJob).to have_been_enqueued
+expect(HeavyLiftingJob).to have_been_enqueued
+HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
+expect(HelloJob).to have_been_enqueued.with(42).on_queue("low").at(Date.tomorrow.noon)
+HelloJob.set(queue: "low").perform_later(42)
+expect(HelloJob).to have_been_enqueued.with(42).on_queue("low").at(:no_wait)
+
+
+ + + + +
+
+436
+437
+438
+439
+
+
# File 'lib/rspec/rails/matchers/active_job.rb', line 436
+def have_been_enqueued
+  check_active_job_adapter
+  ActiveJob::HaveBeenEnqueued.new
+end
+
+
+
+

+ #have_been_performedObject +

+
+

Passes if a job has been performed. May chain at_least, at_most or exactly to specify a number of times.

+
+
+
+
+

Examples:

+
before do
+  ActiveJob::Base.queue_adapter.performed_jobs.clear
+  ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
+  ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = true
+end
+HeavyLiftingJob.perform_later
+expect(HeavyLiftingJob).to have_been_performed
+HelloJob.perform_later
+HeavyLiftingJob.perform_later
+expect(HeavyLiftingJob).to have_been_performed.exactly(:once)
+3.times { HelloJob.perform_later }
+expect(HelloJob).to have_been_performed.at_least(2).times
+HelloJob.perform_later
+HeavyLiftingJob.perform_later
+expect(HelloJob).to have_been_performed
+expect(HeavyLiftingJob).to have_been_performed
+HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
+expect(HelloJob).to have_been_performed.with(42).on_queue("low").at(Date.tomorrow.noon)
+
+
+ + + + +
+
+509
+510
+511
+512
+
+
# File 'lib/rspec/rails/matchers/active_job.rb', line 509
+def have_been_performed
+  check_active_job_adapter
+  ActiveJob::HaveBeenPerformed.new
+end
+
+
+
+

+ #have_broadcasted_to(target = nil) ⇒ Object +

+
+

Passes if a message has been sent to a stream/object inside a block. +May chain at_least, at_most or exactly to specify a number of times. +To specify channel from which message has been broadcasted to object use from_channel.

+
+
+
+
+

Examples:

+
expect {
+  ActionCable.server.broadcast "messages", text: 'Hi!'
+}.to have_broadcasted_to("messages")
+expect {
+  SomeChannel.broadcast_to(user)
+}.to have_broadcasted_to(user).from_channel(SomeChannel)
+# Using alias
+expect {
+  ActionCable.server.broadcast "messages", text: 'Hi!'
+}.to broadcast_to("messages")
+expect {
+  ActionCable.server.broadcast "messages", text: 'Hi!'
+  ActionCable.server.broadcast "all", text: 'Hi!'
+}.to have_broadcasted_to("messages").exactly(:once)
+expect {
+  3.times { ActionCable.server.broadcast "messages", text: 'Hi!' }
+}.to have_broadcasted_to("messages").at_least(2).times
+expect {
+  ActionCable.server.broadcast "messages", text: 'Hi!'
+}.to have_broadcasted_to("messages").at_most(:twice)
+expect {
+  ActionCable.server.broadcast "messages", text: 'Hi!'
+}.to have_broadcasted_to("messages").with(text: 'Hi!')
+
+
+ + + + +
+
+50
+51
+52
+53
+54
+
+
# File 'lib/rspec/rails/matchers/action_cable.rb', line 50
+def have_broadcasted_to(target = nil)
+  check_action_cable_adapter
+  ActionCable::HaveBroadcastedTo.new(target, channel: described_class)
+end
+
+
+
+

+ #have_enqueued_job(job = nil) ⇒ Object + Also known as: + enqueue_job + +

+
+

Passes if a job has been enqueued inside block. May chain at_least, at_most or exactly to specify a number of times.

+
+
+
+
+

Examples:

+
expect {
+  HeavyLiftingJob.perform_later
+}.to have_enqueued_job
+# Using alias
+expect {
+  HeavyLiftingJob.perform_later
+}.to enqueue_job
+expect {
+  HelloJob.perform_later
+  HeavyLiftingJob.perform_later
+}.to have_enqueued_job(HelloJob).exactly(:once)
+expect {
+  3.times { HelloJob.perform_later }
+}.to have_enqueued_job(HelloJob).at_least(2).times
+expect {
+  HelloJob.perform_later
+}.to have_enqueued_job(HelloJob).at_most(:twice)
+expect {
+  HelloJob.perform_later
+  HeavyLiftingJob.perform_later
+}.to have_enqueued_job(HelloJob).and have_enqueued_job(HeavyLiftingJob)
+expect {
+  HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
+}.to have_enqueued_job.with(42).on_queue("low").at(Date.tomorrow.noon)
+expect {
+  HelloJob.set(queue: "low").perform_later(42)
+}.to have_enqueued_job.with(42).on_queue("low").at(:no_wait)
+expect {
+  HelloJob.perform_later('rspec_rails', 'rails', 42)
+}.to have_enqueued_job.with { |from, to, times|
+  # Perform more complex argument matching using dynamic arguments
+  expect(from).to include "_#{to}"
+}
+
+
+ + + + +
+
+401
+402
+403
+404
+
+
# File 'lib/rspec/rails/matchers/active_job.rb', line 401
+def have_enqueued_job(job = nil)
+  check_active_job_adapter
+  ActiveJob::HaveEnqueuedJob.new(job)
+end
+
+
+
+

+ #have_enqueued_mail(mailer_class = nil, mail_method_name = nil) ⇒ Object + Also known as: + have_enqueued_email, enqueue_mail, enqueue_email + +

+
+

Passes if an email has been enqueued inside block. +May chain with to specify expected arguments. +May chain at_least, at_most or exactly to specify a number of times. +May chain at to specify a send time. +May chain on_queue to specify a queue.

+
+
+
+
+

Examples:

+
expect {
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail
+expect {
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail(MyMailer)
+expect {
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail(MyMailer, :welcome)
+# Using alias
+expect {
+  MyMailer.welcome(user).deliver_later
+}.to enqueue_mail(MyMailer, :welcome)
+expect {
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail(MyMailer, :welcome).with(user)
+expect {
+  MyMailer.welcome(user).deliver_later
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail(MyMailer, :welcome).at_least(:once)
+expect {
+  MyMailer.welcome(user).deliver_later
+}.to have_enqueued_mail(MyMailer, :welcome).at_most(:twice)
+expect {
+  MyMailer.welcome(user).deliver_later(wait_until: Date.tomorrow.noon)
+}.to have_enqueued_mail(MyMailer, :welcome).at(Date.tomorrow.noon)
+expect {
+  MyMailer.welcome(user).deliver_later(queue: :urgent_mail)
+}.to have_enqueued_mail(MyMailer, :welcome).on_queue(:urgent_mail)
+
+
+ + + + +
+
+250
+251
+252
+
+
# File 'lib/rspec/rails/matchers/have_enqueued_mail.rb', line 250
+def have_enqueued_mail(mailer_class = nil, mail_method_name = nil)
+  HaveEnqueuedMail.new(mailer_class, mail_method_name)
+end
+
+
+
+

+ #have_http_status(target) ⇒ Object +

+
+

Passes if response has a matching HTTP status code.

+

The following symbolic status codes are allowed:

+
    +
  • Rack::Utils::SYMBOL_TO_STATUS_CODE
  • +
  • One of the defined ActionDispatch::TestResponse aliases: +
      +
    • :error
    • +
    • :missing
    • +
    • :redirect
    • +
    • :success
    • +
  • +
+
+
+
+
+

Examples:

+

Accepts numeric and symbol statuses

+
+
expect(response).to have_http_status(404)
+expect(response).to have_http_status(:created)
+expect(response).to have_http_status(:success)
+expect(response).to have_http_status(:error)
+expect(response).to have_http_status(:missing)
+expect(response).to have_http_status(:redirect)
+

Works with standard response objects and Capybara's page

+
+
expect(response).to have_http_status(404)
+expect(page).to     have_http_status(:created)
+
+

Raises:

+
    +
  • + (ArgumentError) +
  • +
+

See Also:

+ +
+ + + + +
+
+374
+375
+376
+377
+378
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 374
+def have_http_status(target)
+  raise ArgumentError, "Invalid HTTP status: nil" unless target
+  HaveHttpStatus.matcher_for_status(target)
+end
+
+
+
+

+ #have_performed_job(job = nil) ⇒ Object + Also known as: + perform_job + +

+
+

Passes if a job has been performed inside block. May chain at_least, at_most or exactly to specify a number of times.

+
+
+
+
+

Examples:

+
expect {
+  perform_enqueued_jobs { HeavyLiftingJob.perform_later }
+}.to have_performed_job
+expect {
+  perform_enqueued_jobs {
+    HelloJob.perform_later
+    HeavyLiftingJob.perform_later
+  }
+}.to have_performed_job(HelloJob).exactly(:once)
+expect {
+  perform_enqueued_jobs { 3.times { HelloJob.perform_later } }
+}.to have_performed_job(HelloJob).at_least(2).times
+expect {
+  perform_enqueued_jobs { HelloJob.perform_later }
+}.to have_performed_job(HelloJob).at_most(:twice)
+expect {
+  perform_enqueued_jobs {
+    HelloJob.perform_later
+    HeavyLiftingJob.perform_later
+  }
+}.to have_performed_job(HelloJob).and have_performed_job(HeavyLiftingJob)
+expect {
+  perform_enqueued_jobs {
+    HelloJob.set(wait_until: Date.tomorrow.noon, queue: "low").perform_later(42)
+  }
+}.to have_performed_job.with(42).on_queue("low").at(Date.tomorrow.noon)
+
+
+ + + + +
+
+476
+477
+478
+479
+
+
# File 'lib/rspec/rails/matchers/active_job.rb', line 476
+def have_performed_job(job = nil)
+  check_active_job_adapter
+  ActiveJob::HavePerformedJob.new(job)
+end
+
+
+
+

+ #receive_inbound_email(message) ⇒ Object +

+
+

Passes if the given inbound email would be routed to the subject inbox.

+
+
+
+

Parameters:

+
    +
  • + message + (Hash, Mail::Message) + — +

    a mail message or hash of +attributes used to build one

    +
    +
  • +
+
+ + + + +
+
+68
+69
+70
+
+
# File 'lib/rspec/rails/matchers/action_mailbox.rb', line 68
+def receive_inbound_email(message)
+  ActionMailbox::ReceiveInboundEmail.new(message)
+end
+
+
+
+

+ #send_email(criteria = {}) ⇒ Object +

+
+

Check email sending with specific parameters.

+
+
+
+
+

Examples:

+

Positive expectation

+
+
expect { action }.to send_email
+

Negative expectations

+
+
expect { action }.not_to send_email
+

More precise expectation with attributes to match

+
+
expect { action }.to send_email(to: 'test@example.com', subject: 'Confirm email')
+
+
+ + + + +
+
+117
+118
+119
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 117
+def send_email(criteria = {})
+  SendEmail.new(criteria)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable.html new file mode 100644 index 000000000..9cda1f78d --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable.html @@ -0,0 +1,78 @@ + + + + + + + Module: RSpec::Rails::Matchers::ActionCable + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::ActionCable + Private +

+
+
+
Defined in:
+
lib/rspec/rails/matchers/action_cable.rb,
+ lib/rspec/rails/matchers/action_cable/have_streams.rb,
lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb
+
+
+
+

Overview

+
+

+ This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

+

Namespace for various implementations of ActionCable features

+
+
+
+

Defined Under Namespace

+

+ Classes: HaveStream +

+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html new file mode 100644 index 000000000..ab35d1d05 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionCable/HaveStream.html @@ -0,0 +1,272 @@ + + + + + + + Class: RSpec::Rails::Matchers::ActionCable::HaveStream + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::ActionCable::HaveStream + Private +

+
+
+
Inherits:
+
+ Matchers::BuiltIn::BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/matchers/action_cable/have_streams.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Provides the implementation for have_stream, have_stream_for, and have_stream_from. +Not intended to be instantiated directly.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #does_not_match?(subscription) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+31
+32
+33
+
+
# File 'lib/rspec/rails/matchers/action_cable/have_streams.rb', line 31
+def does_not_match?(subscription)
+  !match(subscription)
+end
+
+
+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+11
+12
+13
+
+
# File 'lib/rspec/rails/matchers/action_cable/have_streams.rb', line 11
+def failure_message
+  "expected to have #{base_message}"
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+17
+18
+19
+
+
# File 'lib/rspec/rails/matchers/action_cable/have_streams.rb', line 17
+def failure_message_when_negated
+  "expected not to have #{base_message}"
+end
+
+
+
+

+ #matches?(subscription) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+

Raises:

+
    +
  • + (ArgumentError) +
  • +
+
+ + + + +
+
+23
+24
+25
+26
+27
+
+
# File 'lib/rspec/rails/matchers/action_cable/have_streams.rb', line 23
+def matches?(subscription)
+  raise(ArgumentError, "have_streams is used for negated expectations only") if no_expected?
+  match(subscription)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html new file mode 100644 index 000000000..41db8e3f8 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActionMailbox.html @@ -0,0 +1,73 @@ + + + + + + + Module: RSpec::Rails::Matchers::ActionMailbox + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::ActionMailbox + Private +

+
+
+
Defined in:
+
lib/rspec/rails/matchers/action_mailbox.rb
+
+
+

Overview

+
+

+ This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

+

Namespace for various implementations of ActionMailbox features

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html new file mode 100644 index 000000000..7a5eefb0c --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/ActiveJob.html @@ -0,0 +1,73 @@ + + + + + + + Module: RSpec::Rails::Matchers::ActiveJob + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::ActiveJob + Private +

+
+
+
Defined in:
+
lib/rspec/rails/matchers/active_job.rb
+
+
+

Overview

+
+

+ This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

+

Namespace for various implementations of ActiveJob features

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html new file mode 100644 index 000000000..b72c8667e --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher.html @@ -0,0 +1,451 @@ + + + + + + + Class: RSpec::Rails::Matchers::BaseMatcher + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::BaseMatcher + Private +

+
+
+
Inherits:
+
+ Object +
    +
  • Object
  • + +
+ show all +
+
+
+
Includes:
+
Matchers::Composable, DefaultFailureMessages
+
+
+
Defined in:
+
lib/rspec/rails/matchers/base_matcher.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Base class to build matchers. Should not be instantiated directly.

+
+
+
+
+

Defined Under Namespace

+

+ Modules: DefaultFailureMessages +

+

+ Constant Summary + collapse +

+
+
UNDEFINED = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+

Used to detect when no arg is passed to initialize. +nil cannot be used because it's a valid value to pass.

+
+
+
+
+
+
Object.new.freeze
+
+

+ Instance Method Summary + collapse +

+ +

Methods included from DefaultFailureMessages

+

#failure_message, #failure_message_when_negated

+
+

Constructor Details

+
+

+ #initialize(expected = UNDEFINED) ⇒ BaseMatcher +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a new instance of BaseMatcher.

+
+
+
+
+ + + + +
+
+21
+22
+23
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 21
+def initialize(expected = UNDEFINED)
+  @expected = expected unless UNDEFINED.equal?(expected)
+end
+
+
+
+
+

Instance Method Details

+
+

+ #descriptionString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Generates a description using Matchers::EnglishPhrasing.

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+53
+54
+55
+56
+57
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 53
+def description
+  desc = RSpec::Matchers::EnglishPhrasing.split_words(self.class.matcher_name)
+  desc << RSpec::Matchers::EnglishPhrasing.list(@expected) if defined?(@expected)
+  desc
+end
+
+
+
+

+ #diffable?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Matchers are not diffable by default. Override this to make your +subclass diffable.

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+62
+63
+64
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 62
+def diffable?
+  false
+end
+
+
+
+

+ #expects_call_stack_jump?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+75
+76
+77
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 75
+def expects_call_stack_jump?
+  false
+end
+
+
+
+

+ #match_unless_raises(*exceptions) ⇒ Object +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Used to wrap a block of code that will indicate failure by +raising one of the named exceptions.

+

This is used by rspec-rails for some of its matchers that +wrap rails' assertions.

+
+
+
+
+ + + + +
+
+40
+41
+42
+43
+44
+45
+46
+47
+48
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 40
+def match_unless_raises(*exceptions)
+  exceptions.unshift Exception if exceptions.empty?
+  begin
+    yield
+    true
+  rescue *exceptions => @rescued_exception
+    false
+  end
+end
+
+
+
+

+ #matches?(actual) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Indicates if the match is successful. Delegates to match, which +should be defined on a subclass. Takes care of consistently +initializing the actual attribute.

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+29
+30
+31
+32
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 29
+def matches?(actual)
+  @actual = actual
+  match(expected, actual)
+end
+
+
+
+

+ #supports_block_expectations?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Most matchers are value matchers (i.e. meant to work with expect(value)) +rather than block matchers (i.e. meant to work with expect { }), so +this defaults to false. Block matchers must override this to return true.

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+70
+71
+72
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 70
+def supports_block_expectations?
+  false
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html new file mode 100644 index 000000000..fc2e75734 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BaseMatcher/DefaultFailureMessages.html @@ -0,0 +1,178 @@ + + + + + + + Module: RSpec::Rails::Matchers::BaseMatcher::DefaultFailureMessages + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::BaseMatcher::DefaultFailureMessages + Private +

+
+
+
Included in:
+
RSpec::Rails::Matchers::BaseMatcher
+
+
+
Defined in:
+
lib/rspec/rails/matchers/base_matcher.rb
+
+
+

Overview

+
+

+ This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

+

Provides default implementations of failure messages, based on the description.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Provides a good generic failure message. Based on description. +When subclassing, if you are not satisfied with this failure message +you often only need to override description.

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+153
+154
+155
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 153
+def failure_message
+  "expected #{description_of @actual} to #{description}".dup
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Provides a good generic negative failure message. Based on description. +When subclassing, if you are not satisfied with this failure message +you often only need to override description.

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+162
+163
+164
+
+
# File 'lib/rspec/rails/matchers/base_matcher.rb', line 162
+def failure_message_when_negated
+  "expected #{description_of @actual} not to #{description}".dup
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BeANew.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BeANew.html new file mode 100644 index 000000000..f591586b7 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/BeANew.html @@ -0,0 +1,143 @@ + + + + + + + Class: RSpec::Rails::Matchers::BeANew + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::BeANew + Private +

+
+
+
Inherits:
+
+ BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/matchers/be_a_new.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Matcher class for be_a_new. Should not be instantiated directly.

+
+
+
+

See Also:

+ +
+

Constant Summary

+

Constants inherited + from BaseMatcher

+

RSpec::Rails::Matchers::BaseMatcher::UNDEFINED

+

+ Instance Method Summary + collapse +

+ +

Methods inherited from BaseMatcher

+

#description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

+

Methods included from RSpec::Rails::Matchers::BaseMatcher::DefaultFailureMessages

+

#failure_message_when_negated

+
+

Instance Method Details

+
+

+ #with(expected_attributes) ⇒ Object +

+
+
+
+
+

See Also:

+ +
+ + + + +
+
+23
+24
+25
+26
+
+
# File 'lib/rspec/rails/matchers/be_a_new.rb', line 23
+def with(expected_attributes)
+  attributes.merge!(expected_attributes)
+  self
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html new file mode 100644 index 000000000..e8c672cca --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus.html @@ -0,0 +1,312 @@ + + + + + + + Module: RSpec::Rails::Matchers::HaveHttpStatus + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::HaveHttpStatus + Private +

+
+
+
Included in:
+
GenericStatus, NumericCode, SymbolicStatus
+
+
+
Defined in:
+
lib/rspec/rails/matchers/have_http_status.rb
+
+
+

Overview

+
+

+ This module is part of a private API. + You should avoid using this module if possible, as it may be removed or be changed in the future. +

+

Namespace for various implementations of have_http_status.

+
+
+
+

Defined Under Namespace

+

+ Classes: GenericStatus, NumericCode, SymbolicStatus +

+

+ Class Method Summary + collapse +

+ +

+ Instance Method Summary + collapse +

+ +
+

Class Method Details

+
+

+ .as_test_response(obj) ⇒ ActionDispatch::TestResponse +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Conversion function to coerce the provided object into an +ActionDispatch::TestResponse.

+
+
+
+

Parameters:

+
    +
  • + obj + (Object) + — +

    object to convert to a response

    +
    +
  • +
+

Returns:

+
    +
  • + (ActionDispatch::TestResponse) +
  • +
+
+ + + + +
+
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 35
+def as_test_response(obj)
+  if ::ActionDispatch::Response === obj || ::Rack::MockResponse === obj
+    ::ActionDispatch::TestResponse.from_response(obj)
+  elsif ::ActionDispatch::TestResponse === obj
+    obj
+  elsif obj.respond_to?(:status_code) && obj.respond_to?(:response_headers)
+    # Acts As Capybara Session
+    # Hack to support `Capybara::Session` without having to load
+    # Capybara or catch `NameError`s for the undefined constants
+    obj = ActionDispatch::Response.new.tap do |resp|
+      resp.status  = obj.status_code
+      resp.headers.clear
+      resp.headers.merge!(obj.response_headers)
+      resp.body    = obj.body
+      resp.request = ActionDispatch::Request.new({})
+    end
+    ::ActionDispatch::TestResponse.from_response(obj)
+  else
+    raise TypeError, "Invalid response type: #{obj}"
+  end
+end
+
+
+
+

+ .matcher_for_status(target) ⇒ Object +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Instantiates an instance of the proper matcher based on the provided +target.

+
+
+
+

Parameters:

+
    +
  • + target + (Object) + — +

    expected http status or code

    +
    +
  • +
+

Returns:

+
    +
  • + +

    response matcher instance

    +
    +
  • +
+
+ + + + +
+
+19
+20
+21
+22
+23
+24
+25
+26
+27
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 19
+def self.matcher_for_status(target)
+  if GenericStatus.valid_statuses.include?(target)
+    GenericStatus.new(target)
+  elsif Symbol === target
+    SymbolicStatus.new(target)
+  else
+    NumericCode.new(target)
+  end
+end
+
+
+
+
+

Instance Method Details

+
+

+ #invalid_response_type_messageString? +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a formatted failure message if +@invalid_response is present, nil otherwise.

+
+
+
+

Returns:

+
    +
  • + (String, nil) + — +

    a formatted failure message if +@invalid_response is present, nil otherwise

    +
    +
  • +
+
+ + + + +
+
+60
+61
+62
+63
+64
+65
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 60
+def invalid_response_type_message
+  return unless @invalid_response
+  "expected a response object, but an instance of " \
+  "#{@invalid_response.class} was received"
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html new file mode 100644 index 000000000..533179de4 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/GenericStatus.html @@ -0,0 +1,442 @@ + + + + + + + Class: RSpec::Rails::Matchers::HaveHttpStatus::GenericStatus + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::HaveHttpStatus::GenericStatus + Private +

+
+
+
Inherits:
+
+ BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Includes:
+
RSpec::Rails::Matchers::HaveHttpStatus
+
+
+
Defined in:
+
lib/rspec/rails/matchers/have_http_status.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Provides an implementation for have_http_status matching against +ActionDispatch::TestResponse http status category queries.

+

Not intended to be instantiated directly.

+
+
+
+
+

Examples:

+
expect(response).to have_http_status(:success)
+expect(response).to have_http_status(:error)
+expect(response).to have_http_status(:missing)
+expect(response).to have_http_status(:redirect)
+
+

See Also:

+ +
+

Constant Summary

+

Constants inherited + from BaseMatcher

+

BaseMatcher::UNDEFINED

+

+ Class Method Summary + collapse +

+ +

+ Instance Method Summary + collapse +

+ +

Methods included from RSpec::Rails::Matchers::HaveHttpStatus

+

as_test_response, #invalid_response_type_message, matcher_for_status

+

Methods inherited from BaseMatcher

+

#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

+
+

Constructor Details

+
+

+ #initialize(type) ⇒ GenericStatus +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a new instance of GenericStatus.

+
+
+
+
+ + + + +
+
+251
+252
+253
+254
+255
+256
+257
+258
+259
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 251
+def initialize(type)
+  unless self.class.valid_statuses.include?(type)
+    raise ArgumentError, "Invalid generic HTTP status: #{type.inspect}"
+  end
+  @expected = type
+  @actual = nil
+  @invalid_response = nil
+end
+
+
+
+
+

Class Method Details

+
+

+ .valid_statusesArray<Symbol> +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns of status codes which represent a HTTP status +code "group".

+
+
+
+

Returns:

+
    +
  • + (Array<Symbol>) + — +

    of status codes which represent a HTTP status +code "group"

    +
    +
  • +
+

See Also:

+ +
+ + + + +
+
+243
+244
+245
+246
+247
+248
+249
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 243
+def self.valid_statuses
+  [
+    :error, :success, :missing,
+    :server_error, :successful, :not_found,
+    :redirect
+  ]
+end
+
+
+
+
+

Instance Method Details

+
+

+ #descriptionString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+273
+274
+275
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 273
+def description
+  "respond with #{type_message}"
+end
+
+
+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+278
+279
+280
+281
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 278
+def failure_message
+  invalid_response_type_message ||
+  "expected the response to have #{type_message} but it was #{actual}"
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+284
+285
+286
+287
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 284
+def failure_message_when_negated
+  invalid_response_type_message ||
+  "expected the response not to have #{type_message} but it was #{actual}"
+end
+
+
+
+

+ #matches?(response) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns true if Rack's associated numeric HTTP code matched +the response code or the named response status.

+
+
+
+

Returns:

+
    +
  • + (Boolean) + — +

    true if Rack's associated numeric HTTP code matched +the response code or the named response status

    +
    +
  • +
+
+ + + + +
+
+263
+264
+265
+266
+267
+268
+269
+270
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 263
+def matches?(response)
+  test_response = as_test_response(response)
+  @actual = test_response.response_code
+  check_expected_status(test_response, expected)
+rescue TypeError => _ignored
+  @invalid_response = response
+  false
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html new file mode 100644 index 000000000..23d5e8796 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/NumericCode.html @@ -0,0 +1,373 @@ + + + + + + + Class: RSpec::Rails::Matchers::HaveHttpStatus::NumericCode + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::HaveHttpStatus::NumericCode + Private +

+
+
+
Inherits:
+
+ BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Includes:
+
RSpec::Rails::Matchers::HaveHttpStatus
+
+
+
Defined in:
+
lib/rspec/rails/matchers/have_http_status.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Provides an implementation for have_http_status matching against +numeric http status codes.

+

Not intended to be instantiated directly.

+
+
+
+
+

Examples:

+
expect(response).to have_http_status(404)
+
+

See Also:

+ +
+

Constant Summary

+

Constants inherited + from BaseMatcher

+

BaseMatcher::UNDEFINED

+

+ Instance Method Summary + collapse +

+ +

Methods included from RSpec::Rails::Matchers::HaveHttpStatus

+

as_test_response, #invalid_response_type_message, matcher_for_status

+

Methods inherited from BaseMatcher

+

#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

+
+

Constructor Details

+
+

+ #initialize(code) ⇒ NumericCode +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a new instance of NumericCode.

+
+
+
+
+ + + + +
+
+80
+81
+82
+83
+84
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 80
+def initialize(code)
+  @expected = code.to_i
+  @actual = nil
+  @invalid_response = nil
+end
+
+
+
+
+

Instance Method Details

+
+

+ #descriptionString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+98
+99
+100
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 98
+def description
+  "respond with numeric status code #{expected}"
+end
+
+
+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+103
+104
+105
+106
+107
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 103
+def failure_message
+  invalid_response_type_message ||
+  "expected the response to have status code #{expected.inspect}" \
+    " but it was #{actual.inspect}"
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+110
+111
+112
+113
+114
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 110
+def failure_message_when_negated
+  invalid_response_type_message ||
+  "expected the response not to have status code " \
+  "#{expected.inspect} but it did"
+end
+
+
+
+

+ #matches?(response) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns true if the numeric code matched the response code.

+
+
+
+

Parameters:

+
    +
  • + response + (Object) + — +

    object providing an http code to match

    +
    +
  • +
+

Returns:

+
    +
  • + (Boolean) + — +

    true if the numeric code matched the response code

    +
    +
  • +
+
+ + + + +
+
+88
+89
+90
+91
+92
+93
+94
+95
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 88
+def matches?(response)
+  test_response = as_test_response(response)
+  @actual = test_response.response_code.to_i
+  expected == @actual
+rescue TypeError => _ignored
+  @invalid_response = response
+  false
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html new file mode 100644 index 000000000..ac869ea1f --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/HaveHttpStatus/SymbolicStatus.html @@ -0,0 +1,378 @@ + + + + + + + Class: RSpec::Rails::Matchers::HaveHttpStatus::SymbolicStatus + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::HaveHttpStatus::SymbolicStatus + Private +

+
+
+
Inherits:
+
+ BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Includes:
+
RSpec::Rails::Matchers::HaveHttpStatus
+
+
+
Defined in:
+
lib/rspec/rails/matchers/have_http_status.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Provides an implementation for have_http_status matching against +Rack symbol http status codes.

+

Not intended to be instantiated directly.

+
+
+
+
+

Examples:

+
expect(response).to have_http_status(:created)
+
+

See Also:

+ +
+

Constant Summary

+

Constants inherited + from BaseMatcher

+

BaseMatcher::UNDEFINED

+

+ Instance Method Summary + collapse +

+ +

Methods included from RSpec::Rails::Matchers::HaveHttpStatus

+

as_test_response, #invalid_response_type_message, matcher_for_status

+

Methods inherited from BaseMatcher

+

#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?

+
+

Constructor Details

+
+

+ #initialize(status) ⇒ SymbolicStatus +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a new instance of SymbolicStatus.

+
+
+
+
+ + + + +
+
+131
+132
+133
+134
+135
+136
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 131
+def initialize(status)
+  @expected_status = status
+  @actual = nil
+  @invalid_response = nil
+  set_expected_code!
+end
+
+
+
+
+

Instance Method Details

+
+

+ #descriptionString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+151
+152
+153
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 151
+def description
+  "respond with status code #{pp_expected}"
+end
+
+
+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+156
+157
+158
+159
+160
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 156
+def failure_message
+  invalid_response_type_message ||
+  "expected the response to have status code #{pp_expected} but it" \
+    " was #{pp_actual}"
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns explaining why the match failed.

+
+
+
+

Returns:

+
    +
  • + (String) + — +

    explaining why the match failed

    +
    +
  • +
+
+ + + + +
+
+163
+164
+165
+166
+167
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 163
+def failure_message_when_negated
+  invalid_response_type_message ||
+  "expected the response not to have status code #{pp_expected} " \
+    "but it did"
+end
+
+
+
+

+ #matches?(response) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns true if Rack's associated numeric HTTP code matched +the response code.

+
+
+
+

Parameters:

+
    +
  • + response + (Object) + — +

    object providing an http code to match

    +
    +
  • +
+

Returns:

+
    +
  • + (Boolean) + — +

    true if Rack's associated numeric HTTP code matched +the response code

    +
    +
  • +
+
+ + + + +
+
+141
+142
+143
+144
+145
+146
+147
+148
+
+
# File 'lib/rspec/rails/matchers/have_http_status.rb', line 141
+def matches?(response)
+  test_response = as_test_response(response)
+  @actual = test_response.response_code
+  expected == @actual
+rescue TypeError => _ignored
+  @invalid_response = response
+  false
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html new file mode 100644 index 000000000..dcd71c13c --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RedirectTo.html @@ -0,0 +1,118 @@ + + + + + + + Module: RSpec::Rails::Matchers::RedirectTo + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::RedirectTo +

+
+
+
Included in:
+
ControllerExampleGroup, RequestExampleGroup, SystemExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/matchers/redirect_to.rb
+
+
+

Overview

+
+

Matcher for redirects.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #redirect_to(target) ⇒ Object +

+
+

Delegates to assert_redirected_to.

+
+
+
+
+

Examples:

+
expect(response).to redirect_to(:action => "new")
+
+
+ + + + +
+
+32
+33
+34
+
+
# File 'lib/rspec/rails/matchers/redirect_to.rb', line 32
+def redirect_to(target)
+  RedirectTo.new(self, target)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html new file mode 100644 index 000000000..5b1825cc0 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RenderTemplate.html @@ -0,0 +1,122 @@ + + + + + + + Module: RSpec::Rails::Matchers::RenderTemplate + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::RenderTemplate +

+
+
+
Included in:
+
ControllerExampleGroup, RequestExampleGroup, SystemExampleGroup, ViewExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/matchers/have_rendered.rb
+
+
+

Overview

+
+

Matcher for template rendering.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #have_rendered(options, message = nil) ⇒ Object + Also known as: + render_template + +

+
+

Delegates to assert_template.

+
+
+
+
+

Examples:

+
expect(response).to have_rendered("new")
+
+
+ + + + +
+
+56
+57
+58
+
+
# File 'lib/rspec/rails/matchers/have_rendered.rb', line 56
+def have_rendered(options, message = nil)
+  RenderTemplateMatcher.new(self, options, message)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html new file mode 100644 index 000000000..491bb7a78 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers.html @@ -0,0 +1,178 @@ + + + + + + + Module: RSpec::Rails::Matchers::RoutingMatchers + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::RoutingMatchers +

+
+
+
Extended by:
+
Matchers::DSL
+
+
+
Included in:
+
ControllerExampleGroup, RoutingExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/matchers/routing_matchers.rb
+
+
+

Overview

+
+

Matchers to help with specs for routing code.

+
+
+
+

Defined Under Namespace

+

+ Modules: RouteHelpers +

+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #be_routableObject +

+
+

Passes if the route expression is recognized by the Rails router based on +the declarations in config/routes.rb. Delegates to +RouteSet#recognize_path.

+
+
+
+
+

Examples:

+

You can use route helpers provided by rspec-rails.

+
+
expect(get:  "/a/path").to be_routable
+expect(post: "/another/path").to be_routable
+expect(put:  "/yet/another/path").to be_routable
+
+
+ + + + +
+
+101
+102
+103
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 101
+def be_routable
+  BeRoutableMatcher.new(self)
+end
+
+
+
+

+ #route_to(*expected) ⇒ Object +

+
+

Delegates to assert_recognizes. Supports short-hand controller/action +declarations (e.g. "controller#action").

+
+
+
+
+

Examples:

+

+expect(get: "/things/special").to route_to(
+  controller: "things",
+  action:     "special"
+)
+expect(get: "/things/special").to route_to("things#special")
+
+

See Also:

+ +
+ + + + +
+
+61
+62
+63
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 61
+def route_to(*expected)
+  RouteToMatcher.new(self, *expected)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html new file mode 100644 index 000000000..caa0c8a16 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/RoutingMatchers/RouteHelpers.html @@ -0,0 +1,340 @@ + + + + + + + Module: RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers +

+
+
+
Included in:
+
RoutingExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/matchers/routing_matchers.rb
+
+
+

Overview

+
+

Helpers for matching different route types.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #deleteObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #getObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #headObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #optionsObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #patchObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #postObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+

+ #putObject +

+
+

Shorthand method for matching this type of route.

+
+
+
+
+ + + + +
+
+116
+117
+118
+119
+120
+
+
# File 'lib/rspec/rails/matchers/routing_matchers.rb', line 116
+%w[get post put patch delete options head].each do |method|
+  define_method method do |path|
+    { method.to_sym => path }
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/SendEmail.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/SendEmail.html new file mode 100644 index 000000000..eb83f1e18 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Matchers/SendEmail.html @@ -0,0 +1,390 @@ + + + + + + + Class: RSpec::Rails::Matchers::SendEmail + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Matchers::SendEmail + Private +

+
+
+
Inherits:
+
+ BaseMatcher +
    +
  • Object
  • + + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/matchers/send_email.rb
+
+
+

Overview

+
+

+ This class is part of a private API. + You should avoid using this class if possible, as it may be removed or be changed in the future. +

+

Matcher class for send_email. Should not be instantiated directly.

+
+
+
+

See Also:

+ +
+

+ Constant Summary + collapse +

+
+
INSPECT_EMAIL_ATTRIBUTES = +
+
+

+ This constant is part of a private API. + You should avoid using this constant if possible, as it may be removed or be changed in the future. +

+

Define the email attributes that should be included in the inspection output.

+
+
+
+
+
+
%i[subject from to cc bcc].freeze
+
+

Constants inherited + from BaseMatcher

+

BaseMatcher::UNDEFINED

+

+ Instance Method Summary + collapse +

+ +

Methods inherited from BaseMatcher

+

#description, #expects_call_stack_jump?, #match_unless_raises

+
+

Constructor Details

+
+

+ #initialize(criteria) ⇒ SendEmail +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+

Returns a new instance of SendEmail.

+
+
+
+
+ + + + +
+
+16
+17
+18
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 16
+def initialize(criteria)
+  @criteria = criteria
+end
+
+
+
+
+

Instance Method Details

+
+

+ #failure_messageString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+38
+39
+40
+41
+42
+43
+44
+45
+46
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 38
+def failure_message
+  result =
+    if multiple_match?
+      "More than 1 matching emails were sent."
+    else
+      "No matching emails were sent."
+    end
+  "#{result}#{sent_emails_message}"
+end
+
+
+
+

+ #failure_message_when_negatedString +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (String) +
  • +
+
+ + + + +
+
+50
+51
+52
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 50
+def failure_message_when_negated
+  "Expected not to send an email but it was sent."
+end
+
+
+
+

+ #matches?(block) ⇒ Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+30
+31
+32
+33
+34
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 30
+def matches?(block)
+  define_matched_emails(block)
+  @matched_emails.one?
+end
+
+
+
+

+ #supports_block_expectations?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+26
+27
+28
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 26
+def supports_block_expectations?
+  true
+end
+
+
+
+

+ #supports_value_expectations?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+21
+22
+23
+
+
# File 'lib/rspec/rails/matchers/send_email.rb', line 21
+def supports_value_expectations?
+  false
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ModelExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ModelExampleGroup.html new file mode 100644 index 000000000..357eaa080 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ModelExampleGroup.html @@ -0,0 +1,77 @@ + + + + + + + Module: RSpec::Rails::ModelExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ModelExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/model_example_group.rb
+
+
+

Overview

+
+

Container class for model spec functionality. Does not provide anything +special over the common RailsExampleGroup currently.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/RailsExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/RailsExampleGroup.html new file mode 100644 index 000000000..3ad38ff10 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/RailsExampleGroup.html @@ -0,0 +1,80 @@ + + + + + + + Module: RSpec::Rails::RailsExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::RailsExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActiveSupport::CurrentAttributes::TestHelper, ActiveSupport::ExecutionContext::TestHelper
+
+
+
Included in:
+
ChannelExampleGroup, ControllerExampleGroup, FeatureExampleGroup, HelperExampleGroup, JobExampleGroup, MailerExampleGroup, ModelExampleGroup, RequestExampleGroup, RoutingExampleGroup, SystemExampleGroup, ViewExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/rails_example_group.rb
+
+
+

Overview

+
+

Common rails example functionality.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Railtie.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Railtie.html new file mode 100644 index 000000000..9af659fc7 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Railtie.html @@ -0,0 +1,80 @@ + + + + + + + Class: RSpec::Rails::Railtie + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::Railtie +

+
+
+
Inherits:
+
+ Rails::Railtie +
    +
  • Object
  • + + +
+ show all +
+
+
+
Defined in:
+
lib/rspec-rails.rb
+
+
+

Overview

+
+

Railtie to hook into Rails.

+
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/RequestExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/RequestExampleGroup.html new file mode 100644 index 000000000..6a869c12a --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/RequestExampleGroup.html @@ -0,0 +1,122 @@ + + + + + + + Module: RSpec::Rails::RequestExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::RequestExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionController::TemplateAssertions, ActionDispatch::Assertions, ActionDispatch::Integration::Runner, ActionDispatch::IntegrationTest::Behavior, Matchers::RedirectTo, Matchers::RenderTemplate, RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/request_example_group.rb
+
+
+

Overview

+
+

Container class for request spec functionality.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +

Methods included from Matchers::RenderTemplate

+

#have_rendered

+

Methods included from Matchers::RedirectTo

+

#redirect_to

+
+

Instance Method Details

+
+

+ #appObject +

+
+

Delegates to Rails.application.

+
+
+
+
+ + + + +
+
+16
+17
+18
+
+
# File 'lib/rspec/rails/example/request_example_group.rb', line 16
+def app
+  ::Rails.application
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup.html new file mode 100644 index 000000000..a7531913a --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup.html @@ -0,0 +1,117 @@ + + + + + + + Module: RSpec::Rails::RoutingExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::RoutingExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
AssertionDelegator.new( + ActionDispatch::Assertions::RoutingAssertions +), Matchers::RoutingMatchers, Matchers::RoutingMatchers::RouteHelpers, RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/routing_example_group.rb
+
+
+

Overview

+
+

Container module for routing spec functionality.

+
+
+
+

Defined Under Namespace

+

+ Modules: ClassMethods +

+

Method Summary

+

Methods included from Matchers::RoutingMatchers::RouteHelpers

+

#delete, #get, #head, #options, #patch, #post, #put

+

Methods included from Matchers::RoutingMatchers

+

#be_routable, #route_to

+
+

Dynamic Method Handling

+

+ This class handles dynamic methods through the method_missing method +

+
+

+ #method_missing(m, *args, &block) ⇒ Object (private) +

+
+
+
+
+
+ + + + +
+
+56
+57
+58
+
+
# File 'lib/rspec/rails/example/routing_example_group.rb', line 56
+def method_missing(m, *args, &block)
+  routes.url_helpers.respond_to?(m) ? routes.url_helpers.send(m, *args) : super
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html new file mode 100644 index 000000000..cab72cf6c --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/RoutingExampleGroup/ClassMethods.html @@ -0,0 +1,125 @@ + + + + + + + Module: RSpec::Rails::RoutingExampleGroup::ClassMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::RoutingExampleGroup::ClassMethods +

+
+
+
Defined in:
+
lib/rspec/rails/example/routing_example_group.rb
+
+
+

Overview

+
+

Class-level DSL for route specs.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #routesObject +

+
+

Specifies the routeset that will be used for the example group. This +is most useful when testing Rails engines.

+
+
+
+
+

Examples:

+
describe MyEngine::PostsController do
+  routes { MyEngine::Engine.routes }
+  it "routes posts#index" do
+    expect(:get => "/posts").to
+      route_to(:controller => "my_engine/posts", :action => "index")
+  end
+end
+
+
+ + + + +
+
+31
+32
+33
+34
+35
+
+
# File 'lib/rspec/rails/example/routing_example_group.rb', line 31
+def routes
+  before do
+    self.routes = yield
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/SystemExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/SystemExampleGroup.html new file mode 100644 index 000000000..9d8007e2e --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/SystemExampleGroup.html @@ -0,0 +1,201 @@ + + + + + + + Module: RSpec::Rails::SystemExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::SystemExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionController::TemplateAssertions, ActionDispatch::Assertions, ActionDispatch::Integration::Runner, Matchers::RedirectTo, Matchers::RenderTemplate, RailsExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/example/system_example_group.rb
+
+
+

Overview

+
+

Container class for system tests

+
+
+
+
+

+ Constant Summary + collapse +

+
+
CHARS_TO_TRANSLATE = +
+
+

Special characters to translate into underscores for #method_name

+
+
+
+
+
+
['/', '.', ':', ',', "'", '"', " "].freeze
+
DEFAULT_DRIVER = +
+
+

Default driver to assign if none specified.

+
+
+
+
+
+
if ::Rails::VERSION::STRING.to_f >= 7.2
+  :selenium_chrome_headless
+else
+  :selenium
+end
+
+

+ Instance Method Summary + collapse +

+ +

Methods included from Matchers::RenderTemplate

+

#have_rendered

+

Methods included from Matchers::RedirectTo

+

#redirect_to

+
+

Instance Method Details

+
+

+ #appObject +

+
+

Delegates to Rails.application.

+
+
+
+
+ + + + +
+
+94
+95
+96
+
+
# File 'lib/rspec/rails/example/system_example_group.rb', line 94
+def app
+  ::Rails.application
+end
+
+
+
+

+ #passed?Boolean +

+
+

for the SystemTesting Screenshot situation

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+29
+30
+31
+32
+33
+34
+35
+36
+37
+
+
# File 'lib/rspec/rails/example/system_example_group.rb', line 29
+def passed?
+  return false if RSpec.current_example.exception
+  return true unless defined?(::RSpec::Expectations::FailureAggregator)
+  failure_notifier = ::RSpec::Support.failure_notifier
+  return true unless failure_notifier.is_a?(::RSpec::Expectations::FailureAggregator)
+  failure_notifier.failures.empty? && failure_notifier.other_errors.empty?
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/Version.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/Version.html new file mode 100644 index 000000000..f9b121fa8 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/Version.html @@ -0,0 +1,84 @@ + + + + + + + Module: RSpec::Rails::Version + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::Version +

+
+
+
Defined in:
+
lib/rspec/rails/version.rb
+
+
+

Overview

+
+

Version information for RSpec Rails.

+
+
+
+
+

+ Constant Summary + collapse +

+
+
STRING = +
+
+

Current version of RSpec Rails, in semantic versioning format.

+
+
+
+
+
+
'7.1.0'
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewAssigns.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewAssigns.html new file mode 100644 index 000000000..936ecfb65 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewAssigns.html @@ -0,0 +1,153 @@ + + + + + + + Module: RSpec::Rails::ViewAssigns + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewAssigns +

+
+
+
Included in:
+
HelperExampleGroup, ViewExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/view_assigns.rb
+
+
+

Overview

+
+

Helpers for making instance variables available to views.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #assign(key, value) ⇒ Object +

+
+

Assigns a value to an instance variable in the scope of the +view being rendered.

+
+
+
+
+

Examples:

+

+assign(:widget, stub_model(Widget))
+
+
+ + + + +
+
+11
+12
+13
+
+
# File 'lib/rspec/rails/view_assigns.rb', line 11
+def assign(key, value)
+  _encapsulated_assigns[key] = value
+end
+
+
+
+

+ #view_assignsObject +

+
+

Compat-shim for AbstractController::Rendering#view_assigns

+
+
+
+
+ + + + +
+
+16
+17
+18
+
+
# File 'lib/rspec/rails/view_assigns.rb', line 16
+def view_assigns
+  super.merge(_encapsulated_assigns)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup.html new file mode 100644 index 000000000..42efc4698 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup.html @@ -0,0 +1,84 @@ + + + + + + + Module: RSpec::Rails::ViewExampleGroup + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewExampleGroup +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Includes:
+
ActionView::TestCase::Behavior, Matchers::RenderTemplate, RailsExampleGroup, ViewAssigns
+
+
+
Defined in:
+
lib/rspec/rails/example/view_example_group.rb
+
+
+

Overview

+
+

Container class for view spec functionality.

+
+
+
+

Defined Under Namespace

+

+ Modules: ExampleMethods +

+

Method Summary

+

Methods included from Matchers::RenderTemplate

+

#have_rendered

+

Methods included from ViewAssigns

+

#assign, #view_assigns

+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html new file mode 100644 index 000000000..3020f4ddb --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewExampleGroup/ExampleMethods.html @@ -0,0 +1,340 @@ + + + + + + + Module: RSpec::Rails::ViewExampleGroup::ExampleMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewExampleGroup::ExampleMethods +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Defined in:
+
lib/rspec/rails/example/view_example_group.rb
+
+
+

Overview

+
+

DSL exposed to view specs.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #paramsObject +

+
+

Provides access to the params hash that will be available within the +view.

+
params[:foo] = 'bar'
+
+
+
+
+
+ + + + +
+
+100
+101
+102
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 100
+def params
+  controller.params
+end
+
+
+
+

+ #renderObject + #render({partial: path_to_file}) ⇒ Object + #render({partial: path_to_file}, {... locals ...}) ⇒ Object + #render({partial: path_to_file}, {... locals ...}) ⇒ Object +

+
+

Delegates to ActionView::Base#render, so see documentation on that +for more info.

+

The only addition is that you can call render with no arguments, and +RSpec will pass the top level description to render:

+
describe "widgets/new.html.erb" do
+  it "shows all the widgets" do
+    render # => view.render(file: "widgets/new.html.erb")
+    # ...
+  end
+end
+
+
+
+
+
+ + + + +
+
+66
+67
+68
+69
+70
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 66
+def render(options = {}, local_assigns = {}, &block)
+  options = _default_render_options if Hash === options && options.empty?
+  options = options.merge(_default_render_options) if Hash === options && options.keys == [:locals]
+  super(options, local_assigns, &block)
+end
+
+
+
+

+ #responseObject +

+
+
Deprecated.

Use rendered instead.

+
+
+
+
+
+ + + + +
+
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 111
+def response
+  # `assert_template` expects `response` to implement a #body method
+  # like an `ActionDispatch::Response` does to force the view to
+  # render. For backwards compatibility, we use #response as an alias
+  # for #rendered, but it needs to implement #body to avoid
+  # `assert_template` raising a `NoMethodError`.
+  unless rendered.respond_to?(:body)
+    def rendered.body
+      self
+    end
+  end
+  rendered
+end
+
+
+
+

+ #stub_template(hash) ⇒ Object +

+
+

Simulates the presence of a template on the file system by adding a +Rails' FixtureResolver to the front of the view_paths list. Designed to +help isolate view examples from partials rendered by the view template +that is the subject of the example.

+
stub_template("widgets/_widget.html.erb" => "This content.")
+
+
+
+
+
+ + + + +
+
+92
+93
+94
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 92
+def stub_template(hash)
+  controller.prepend_view_path(StubResolverCache.resolver_for(hash))
+end
+
+
+
+

+ #templateObject +

+
+
Deprecated.

Use view instead.

+
+
+
+
+
+ + + + +
+
+105
+106
+107
+108
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 105
+def template
+  RSpec.deprecate("template", replacement: "view")
+  view
+end
+
+
+
+

+ #viewObject +

+
+

The instance of ActionView::Base that is used to render the template. +Use this to stub methods before calling render.

+
describe "widgets/new.html.erb" do
+  it "shows all the widgets" do
+    view.stub(:foo) { "foo" }
+    render
+    # ...
+  end
+end
+
+
+
+
+
+ + + + +
+
+82
+83
+84
+
+
# File 'lib/rspec/rails/example/view_example_group.rb', line 82
+def view
+  _view
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewPathBuilder.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewPathBuilder.html new file mode 100644 index 000000000..dece86b7a --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewPathBuilder.html @@ -0,0 +1,173 @@ + + + + + + + Class: RSpec::Rails::ViewPathBuilder + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Class: RSpec::Rails::ViewPathBuilder +

+
+
+
Inherits:
+
+ Object +
    +
  • Object
  • + +
+ show all +
+
+
+
Defined in:
+
lib/rspec/rails/view_path_builder.rb
+
+
+

Overview

+
+

Builds paths for view specs using a particular route set.

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Constructor Details

+
+

+ #initialize(route_set) ⇒ ViewPathBuilder +

+
+

Returns a new instance of ViewPathBuilder.

+
+
+
+
+ + + + +
+
+5
+6
+7
+
+
# File 'lib/rspec/rails/view_path_builder.rb', line 5
+def initialize(route_set)
+  self.class.send(:include, route_set.url_helpers)
+end
+
+
+
+
+

Instance Method Details

+
+

+ #path_for(path_params) ⇒ Object +

+
+

Given a hash of parameters, build a view path, if possible. +Returns nil if no path can be built from the given params.

+
+
+
+
+

Examples:

+
# path can be built because all required params are present in the hash
+view_path_builder = ViewPathBuilder.new(::Rails.application.routes)
+view_path_builder.path_for({ :controller => 'posts', :action => 'show', :id => '54' })
+# => "/post/54"
+
# path cannot be built because the params are missing a required element (:id)
+view_path_builder.path_for({ :controller => 'posts', :action => 'delete' })
+# => ActionController::UrlGenerationError: No route matches {:action=>"delete", :controller=>"posts"}
+
+
+ + + + +
+
+22
+23
+24
+25
+26
+
+
# File 'lib/rspec/rails/view_path_builder.rb', line 22
+def path_for(path_params)
+  url_for(path_params.merge(only_path: true))
+rescue => e
+  e.message
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering.html new file mode 100644 index 000000000..500cd35a6 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering.html @@ -0,0 +1,171 @@ + + + + + + + Module: RSpec::Rails::ViewRendering + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewRendering +

+
+
+
Extended by:
+
ActiveSupport::Concern
+
+
+
Included in:
+
ControllerExampleGroup
+
+
+
Defined in:
+
lib/rspec/rails/view_rendering.rb
+
+
+

Overview

+
+

Helpers for optionally rendering views in controller specs.

+
+
+
+

Defined Under Namespace

+

+ Modules: ClassMethods +

+

Instance Attribute Summary collapse

+ +

+ Instance Method Summary + collapse +

+ +
+

Instance Attribute Details

+ +
+

+ #controllerObject +

+
+

Returns the controller object instance under test.

+
+
+
+
+ + + + +
+
+12
+13
+14
+
+
# File 'lib/rspec/rails/view_rendering.rb', line 12
+def controller
+  @controller
+end
+
+
+
+
+

Instance Method Details

+
+

+ #render_views?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+38
+39
+40
+
+
# File 'lib/rspec/rails/view_rendering.rb', line 38
+def render_views?
+  self.class.render_views? || !controller.class.respond_to?(:view_paths)
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html new file mode 100644 index 000000000..fd36f3f3c --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewRendering/ClassMethods.html @@ -0,0 +1,165 @@ + + + + + + + Module: RSpec::Rails::ViewRendering::ClassMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewRendering::ClassMethods +

+
+
+
Defined in:
+
lib/rspec/rails/view_rendering.rb
+
+
+

Overview

+
+

DSL methods

+
+
+
+
+

+ Instance Method Summary + collapse +

+ +
+

Instance Method Details

+
+

+ #render_views(true_or_false = true) ⇒ Object +

+
+
+
+
+

See Also:

+ +
+ + + + +
+
+21
+22
+23
+
+
# File 'lib/rspec/rails/view_rendering.rb', line 21
+def render_views(true_or_false = true)
+  @render_views = true_or_false
+end
+
+
+
+

+ #render_views?Boolean +

+
+

+ This method is part of a private API. + You should avoid using this method if possible, as it may be removed or be changed in the future. +

+
+
+
+

Returns:

+
    +
  • + (Boolean) +
  • +
+
+ + + + +
+
+26
+27
+28
+29
+30
+31
+32
+33
+34
+
+
# File 'lib/rspec/rails/view_rendering.rb', line 26
+def render_views?
+  return @render_views if defined?(@render_views)
+  if superclass.respond_to?(:render_views?)
+    superclass.render_views?
+  else
+    RSpec.configuration.render_views?
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewSpecMethods.html b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewSpecMethods.html new file mode 100644 index 000000000..f05287749 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/RSpec/Rails/ViewSpecMethods.html @@ -0,0 +1,214 @@ + + + + + + + Module: RSpec::Rails::ViewSpecMethods + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Module: RSpec::Rails::ViewSpecMethods +

+
+
+
Defined in:
+
lib/rspec/rails/view_spec_methods.rb
+
+
+

Overview

+
+

Adds methods (generally to ActionView::TestCase::TestController). +Intended for use in view specs.

+
+
+
+
+

+ Class Method Summary + collapse +

+ +
+

Class Method Details

+
+

+ .add_to(klass) ⇒ Object +

+
+

Adds methods extra_params= and extra_params to the indicated class. +When class is ::ActionView::TestCase::TestController, these methods +are exposed in view specs on the controller object.

+
+
+
+
+ + + + +
+
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+
+
# File 'lib/rspec/rails/view_spec_methods.rb', line 11
+def add_to(klass)
+  return if klass.method_defined?(:extra_params) && klass.method_defined?(:extra_params=)
+  klass.module_exec do
+    # Set any extra parameters that rendering a URL for this view
+    # would require.
+    #
+    # @example
+    #
+    #     # In "spec/views/widgets/show.html.erb_spec.rb":
+    #     before do
+    #       widget = Widget.create!(:name => "slicer")
+    #       controller.extra_params = { :id => widget.id }
+    #     end
+    def extra_params=(hash)
+      @extra_params = hash
+      request.path =
+        ViewPathBuilder.new(::Rails.application.routes).path_for(
+          extra_params.merge(request.path_parameters)
+        )
+    end
+    # Use to read extra parameters that are set in the view spec.
+    #
+    # @example
+    #
+    #     # After the before in the above example:
+    #     controller.extra_params
+    #     # => { :id => 4 }
+    def extra_params
+      @extra_params ||= {}
+      @extra_params.dup.freeze
+    end
+  end
+end
+
+
+
+

+ .remove_from(klass) ⇒ Object +

+
+

Removes methods extra_params= and extra_params from the indicated class.

+
+
+
+
+ + + + +
+
+48
+49
+50
+51
+52
+53
+
+
# File 'lib/rspec/rails/view_spec_methods.rb', line 48
+def remove_from(klass)
+  klass.module_exec do
+    undef extra_params= if klass.method_defined?(:extra_params=)
+    undef extra_params  if klass.method_defined?(:extra_params)
+  end
+end
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/_index.html b/source/documentation/7.1/rspec-rails/_index.html new file mode 100644 index 000000000..d42e6fb16 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/_index.html @@ -0,0 +1,321 @@ + + + + + + + Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

Documentation by YARD 0.9.37

+
+

Alphabetic Index

+

File Listing

+ +
+

Namespace Listing A-Z

+ + + + +
+ +
    +
  • B
  • +
      +
    • + BaseMatcher + (RSpec::Rails::Matchers) +
    • +
    • + BeANew + (RSpec::Rails::Matchers) +
    • +
    +
+ + + + +
    +
  • G
  • +
      +
    • + GenericStatus + (RSpec::Rails::Matchers::HaveHttpStatus) +
    • +
    +
+
+ + + +
    +
  • N
  • +
      +
    • + NumericCode + (RSpec::Rails::Matchers::HaveHttpStatus) +
    • +
    +
+ + + +
+
+
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/class_list.html b/source/documentation/7.1/rspec-rails/class_list.html new file mode 100644 index 000000000..56ad540dc --- /dev/null +++ b/source/documentation/7.1/rspec-rails/class_list.html @@ -0,0 +1,39 @@ + + + + + + + + + + Class List + + + +
+
+

Class List

+ + +
+ +
+ + diff --git a/source/documentation/7.1/rspec-rails/css/common.css b/source/documentation/7.1/rspec-rails/css/common.css new file mode 100644 index 000000000..cf25c4523 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/css/full_list.css b/source/documentation/7.1/rspec-rails/css/full_list.css new file mode 100644 index 000000000..6eef5e4a0 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/css/full_list.css @@ -0,0 +1,58 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; + background: #fafafa; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +.fixed_header { position: fixed; background: #fff; width: 100%; padding-bottom: 10px; margin-top: 0; top: 0; z-index: 9999; height: 70px; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCAAAACwAAAAAEAAQAAAHaIAAgoMgIiYlg4kACxIaACEJCSiKggYMCRselwkpghGJBJEcFgsjJyoAGBmfggcNEx0flBiKDhQFlIoCCA+5lAORFb4AJIihCRbDxQAFChAXw9HSqb60iREZ1omqrIPdJCTe0SWI09GBACH5BAkIAAAALAAAAAAQABAAAAdrgACCgwc0NTeDiYozCQkvOTo9GTmDKy8aFy+NOBA7CTswgywJDTIuEjYFIY0JNYMtKTEFiRU8Pjwygy4ws4owPyCKwsMAJSTEgiQlgsbIAMrO0dKDGMTViREZ14kYGRGK38nHguHEJcvTyIEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDAggPg4iJAAMJCRUAJRIqiRGCBI0WQEEJJkWDERkYAAUKEBc4Po1GiKKJHkJDNEeKig4URLS0ICImJZAkuQAhjSi/wQyNKcGDCyMnk8u5rYrTgqDVghgZlYjcACTA1sslvtHRgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCQARAtOUoQRGRiFD0kJUYWZhUhKT1OLhR8wBaaFBzQ1NwAlkIszCQkvsbOHL7Y4q4IuEjaqq0ZQD5+GEEsJTDCMmIUhtgk1lo6QFUwJVDKLiYJNUd6/hoEAIfkECQgAAAAsAAAAABAAEAAAB2iAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4uen4ICCA+IkIsDCQkVACWmhwSpFqAABQoQF6ALTkWFnYMrVlhWvIKTlSAiJiVVPqlGhJkhqShHV1lCW4cMqSkAR1ofiwsjJyqGgQAh+QQJCAAAACwAAAAAEAAQAAAHZ4AAgoOEhYaCJSWHgxGDJCSMhREZGIYYGY2ElYebi56fhyWQniSKAKKfpaCLFlAPhl0gXYNGEwkhGYREUywag1wJwSkHNDU3D0kJYIMZQwk8MjPBLx9eXwuETVEyAC/BOKsuEjYFhoEAIfkECQgAAAAsAAAAABAAEAAAB2eAAIKDhIWGgiUlh4MRgyQkjIURGRiGGBmNhJWHm4ueICImip6CIQkJKJ4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; margin-top: 80px; font-size: 1.1em; } +#full_list ul { padding: 0; } +#full_list li { padding: 0; margin: 0; list-style: none; } +#full_list li .item { padding: 5px 5px 5px 12px; } +#noresults { padding: 7px 12px; background: #fff; } +#content.insearch #noresults { margin-left: 7px; } +li.collapsed ul { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { cursor: default; background-position: top left; } +li { color: #666; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.odd { background: #f0f0f0; } +li.even { background: #fafafa; } +.item:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a, a:visited { text-decoration: none; color: #05a; } +li.clicked > .item { background: #05a; color: #ccc; } +li.clicked > .item a, li.clicked > .item a:visited { color: #eee; } +li.clicked > .item a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; border-radius: 3px; } +#full_list_nav { margin-left: 10px; font-size: 0.9em; display: block; color: #aaa; } +#full_list_nav a, #nav a:visited { color: #358; } +#full_list_nav a:hover { background: transparent; color: #5af; } +#full_list_nav span:after { content: ' | '; } +#full_list_nav span:last-child:after { content: ''; } + +#content h1 { margin-top: 0; } +li { white-space: nowrap; cursor: normal; } +li small { display: block; font-size: 0.8em; } +li small:before { content: ""; } +li small:after { content: ""; } +li small.search_info { display: none; } +#search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #666; padding-left: 0; padding-right: 24px; } +#content.insearch #search { background-position: center right; } +#search input { width: 110px; } + +#full_list.insearch ul { display: block; } +#full_list.insearch .item { display: none; } +#full_list.insearch .found { display: block; padding-left: 11px !important; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/source/documentation/7.1/rspec-rails/css/rspec.css b/source/documentation/7.1/rspec-rails/css/rspec.css new file mode 100644 index 000000000..b2fb819aa --- /dev/null +++ b/source/documentation/7.1/rspec-rails/css/rspec.css @@ -0,0 +1,20 @@ +.notetag { + background-color: #FFE5E5; +} + +code { + background-color: #F0F0F0; + padding: 0 2px 0 2px; +} + +.deprecated code { + background-color: #FFA8A8; +} + +.summary_desc code { + background-color: #F0F0F0; +} + +.notetag code { + background-color: #FFA8A8; +} diff --git a/source/documentation/7.1/rspec-rails/css/style.css b/source/documentation/7.1/rspec-rails/css/style.css new file mode 100644 index 000000000..f169a6518 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/css/style.css @@ -0,0 +1,503 @@ +html { + width: 100%; + height: 100%; +} +body { + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + width: 100%; + margin: 0; + padding: 0; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; +} + +#nav { + position: relative; + width: 100%; + height: 100%; + border: 0; + border-right: 1px dotted #eee; + overflow: auto; +} +.nav_wrap { + margin: 0; + padding: 0; + width: 20%; + height: 100%; + position: relative; + display: flex; + display: -webkit-flex; + display: -ms-flexbox; + flex-shrink: 0; + -webkit-flex-shrink: 0; + -ms-flex: 1 0; +} +#resizer { + position: absolute; + right: -5px; + top: 0; + width: 10px; + height: 100%; + cursor: col-resize; + z-index: 9999; +} +#main { + flex: 5 1; + -webkit-flex: 5 1; + -ms-flex: 5 1; + outline: none; + position: relative; + background: #fff; + padding: 1.2em; + padding-top: 0.2em; + box-sizing: border-box; +} + +@media (max-width: 920px) { + .nav_wrap { width: 100%; top: 0; right: 0; overflow: visible; position: absolute; } + #resizer { display: none; } + #nav { + z-index: 9999; + background: #fff; + display: none; + position: absolute; + top: 40px; + right: 12px; + width: 500px; + max-width: 80%; + height: 80%; + overflow-y: scroll; + border: 1px solid #999; + border-collapse: collapse; + box-shadow: -7px 5px 25px #aaa; + border-radius: 2px; + } +} + +@media (min-width: 920px) { + body { height: 100%; overflow: hidden; } + #main { height: 100%; overflow: auto; } + #search { display: none; } +} + +@media (max-width: 320px) { + body { height: 100%; overflow: hidden; overflow-wrap: break-word; } + #main { height: 100%; overflow: auto; } +} + +#main img { max-width: 100%; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; + position: relative; +} +h2 small { font-weight: normal; font-size: 0.7em; display: inline; position: absolute; right: 0; } +h2 small a { + display: block; + height: 20px; + border: 1px solid #aaa; + border-bottom: 0; + border-top-left-radius: 5px; + background: #f8f8f8; + position: relative; + padding: 2px 7px; +} +a { font-weight: 550; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring, .tags, #filecontents { font-size: 15px; line-height: 1.5145em; } +.docstring p > code, .docstring p > tt, .tags p > code, .tags p > tt { + color: #c7254e; background: #f9f2f4; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link a, .docstring .object_link a { + font-family: monospace; font-size: 1.05em; + color: #05a; background: #EDF4FA; padding: 2px 4px; font-size: 1em; + border-radius: 4px; +} +.rdoc-term { padding-right: 25px; font-weight: bold; } +.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; } +.summary_desc pre.code .object_link a, .docstring pre.code .object_link a { + padding: 0px; background: inherit; color: inherit; border-radius: inherit; +} + +/* style for */ +#filecontents table, .docstring table { border-collapse: collapse; } +#filecontents table th, #filecontents table td, +.docstring table th, .docstring table td { border: 1px solid #ccc; padding: 8px; padding-right: 17px; } +#filecontents table tr:nth-child(odd), +.docstring table tr:nth-child(odd) { background: #eee; } +#filecontents table tr:nth-child(even), +.docstring table tr:nth-child(even) { background: #fff; } +#filecontents table th, .docstring table th { background: #fff; } + +/* style for
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RSpec matcherDelegates toAvailable inNotes
be_a_newallprimarily intended for controller specs
render_templateassert_templaterequest / controller / viewuse with expect(response).to
redirect_toassert_redirectrequest / controlleruse with expect(response).to
route_toassert_recognizesrouting / controlleruse with expect(...).to route_to
be_routablerouting / controlleruse with expect(...).not_to be_routable
have_http_statusrequest / controller / feature
match_arrayallfor comparing arrays of ActiveRecord objects
have_been_enqueuedallrequires config: ActiveJob::Base.queue_adapter = :test
have_enqueued_joballrequires config: ActiveJob::Base.queue_adapter = :test
+

Follow the links above for examples of how each matcher is used.

+

What else does RSpec Rails add?

+

For a comprehensive look at RSpec Rails’ features, +read the official Cucumber documentation.

+

What tests should I write?

+

RSpec Rails defines ten different types of specs +for testing different parts of a typical Rails application. +Each one inherits from one of Rails’ built-in TestCase classes, +meaning the helper methods provided by default in Rails tests +are available in RSpec, as well.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Spec typeCorresponding Rails test class
model
controllerActionController::TestCase
mailerActionMailer::TestCase
job
viewActionView::TestCase
routing
helperActionView::TestCase
requestActionDispatch::IntegrationTest
feature
systemActionDispatch::SystemTestCase
+

Follow the links above to see examples of each spec type, +or for official Rails API documentation on the given TestCase class.

+
+

Note: This is not a checklist.

+

Ask a hundred developers how to test an application, +and you’ll get a hundred different answers.

+

RSpec Rails provides thoughtfully selected features +to encourage good testing practices, but there’s no “right” way to do it. +Ultimately, it’s up to you to decide how your test suite will be composed.

+
+

When creating a spec file, +assign it a type in the top-level describe block, like so:

+
# spec/models/user_spec.rb
+RSpec.describe User, type: :model do
+...
+
+

System specs, feature specs, request specs–what’s the difference?

+

RSpec Rails provides some end-to-end (entire application) testing capability +to specify the interaction with the client.

+

System specs

+

Also called acceptance tests, browser tests, or end-to-end tests, +system specs test the application from the perspective of a human client. +The test code walks through a user’s browser interactions,

+ +

and the expectations revolve around page content.

+ +

Because system specs are a wrapper around Rails’ built-in SystemTestCase, +they’re only available on Rails 5.1+. +(Feature specs serve the same purpose, but without this dependency.)

+

Feature specs

+

Before Rails introduced system testing facilities, +feature specs were the only spec type for end-to-end testing. +While the RSpec team now officially recommends system specs instead, +feature specs are still fully supported, look basically identical, +and work on older versions of Rails.

+

On the other hand, feature specs require non-trivial configuration +to get some important features working, +like JavaScript testing or making sure each test runs with a fresh DB state. +With system specs, this configuration is provided out-of-the-box.

+

Like system specs, feature specs require the Capybara gem. +Rails 5.1+ includes it by default as part of system tests, +but if you don’t have the luxury of upgrading, +be sure to add it to the :test group of your Gemfile first:

+
group :test do
+  gem "capybara"
+end
+
+

Request specs

+

Request specs are for testing the application +from the perspective of a machine client. +They begin with an HTTP request and end with the HTTP response, +so they’re faster than feature specs, +but do not examine your app’s UI or JavaScript.

+

Request specs provide a high-level alternative to controller specs. +In fact, as of RSpec 3.5, both the Rails and RSpec teams +discourage directly testing controllers +in favor of functional tests like request specs.

+

When writing them, try to answer the question, +“For a given HTTP request (verb + path + parameters), +what HTTP response should the application return?”

+

Contributing

+ +

Once you’ve cloned the repo and set up the environment, +you can run the specs and Cucumber features, or submit a pull request.

+

See Also

+

RSpec base libraries

+ + + + + + + + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/file_list.html b/source/documentation/7.1/rspec-rails/file_list.html new file mode 100644 index 000000000..53c6f80d2 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/file_list.html @@ -0,0 +1,49 @@ + + + + + + + + + + File List + + + +
+
+

File List

+ + +
+ +
+ + diff --git a/source/documentation/7.1/rspec-rails/frames.html b/source/documentation/7.1/rspec-rails/frames.html new file mode 100644 index 000000000..6586005fd --- /dev/null +++ b/source/documentation/7.1/rspec-rails/frames.html @@ -0,0 +1,22 @@ + + + + + Documentation by YARD 0.9.37 + + + + diff --git a/source/documentation/7.1/rspec-rails/index.html b/source/documentation/7.1/rspec-rails/index.html new file mode 100644 index 000000000..4ab9ece99 --- /dev/null +++ b/source/documentation/7.1/rspec-rails/index.html @@ -0,0 +1,391 @@ + + + + + + + File: README + — Documentation by YARD 0.9.37 + + + + + + + + + + +
+ +

rspec-rails Code Climate Gem Version

+

rspec-rails brings the RSpec testing framework to Ruby on Rails +as a drop-in alternative to its default testing framework, Minitest.

+

In RSpec, tests are not just scripts that verify your application code. +They’re also specifications (or specs, for short): +detailed explanations of how the application is supposed to behave, +expressed in plain English.

+

According to RSpec Rails new versioning strategy use:

+ +

Installation

+

IMPORTANT This README / branch refers to the 7.1.x stable release series, only bugfixes from this series will +be added here. See the main branch on Github if you want or +require the latest unstable features.

+
    +
  1. Add rspec-rails to both the :development and :test groups +of your app’s Gemfile:
  2. +
+
   # Run against this stable release
+   group :development, :test do
+     gem 'rspec-rails', '~> 7.0.0'
+   end
+   # Or, run against the main branch
+   # (requires main-branch versions of all related RSpec libraries)
+   group :development, :test do
+     %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
+       gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
+     end
+   end
+
+

(Adding it to the :development group is not strictly necessary, + but without it, generators and rake tasks must be preceded by RAILS_ENV=test.)

+
    +
  1. Then, in your project directory:
  2. +
+
   # Download and install
+   $ bundle install
+   # Generate boilerplate configuration files
+   # (check the comments in each generated file for more information)
+   $ rails generate rspec:install
+         create  .rspec
+         create  spec
+         create  spec/spec_helper.rb
+         create  spec/rails_helper.rb
+
+

Upgrading

+

If your project is already using an older version of rspec-rails, +upgrade to the latest version with:

+
$ bundle update rspec-rails
+
+

RSpec follows semantic versioning, +which means that “major version” upgrades (e.g., 2.x → 3.x) +come with breaking changes. +If you’re upgrading from version 2.x or below, +read the rspec-rails upgrade notes to find out what to watch out for.

+

Be sure to check the general RSpec upgrade notes as well.

+

Usage

+

Creating boilerplate specs with rails generate

+
# RSpec hooks into built-in generators
+$ rails generate model user
+      invoke  active_record
+      create    db/migrate/20181017040312_create_users.rb
+      create    app/models/user.rb
+      invoke    rspec
+      create      spec/models/user_spec.rb
+# RSpec also provides its own spec file generators
+$ rails generate rspec:model user
+      create  spec/models/user_spec.rb
+# List all RSpec generators
+$ rails generate --help | grep rspec
+
+

Running specs

+
# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
+$ bundle exec rspec
+# Run all spec files in a single directory (recursively)
+$ bundle exec rspec spec/models
+# Run a single spec file
+$ bundle exec rspec spec/controllers/accounts_controller_spec.rb
+# Run a single example from a spec file (by line number)
+$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8
+# See all options for running specs
+$ bundle exec rspec --help
+
+

Optional: If bundle exec rspec is too verbose for you, +you can generate a binstub at bin/rspec and use that instead:

+
 $ bundle binstubs rspec-core
+
+

RSpec DSL Basics (or, how do I write a spec?)

+

In RSpec, application behavior is described +first in (almost) plain English, then again in test code, like so:

+
RSpec.describe 'Post' do           #
+  context 'before publication' do  # (almost) plain English
+    it 'cannot have comments' do   #
+      expect { Post.create.comments.create! }.to raise_error(ActiveRecord::RecordInvalid)  # test code
+    end
+  end
+end
+
+

Running rspec will execute this test code, +and then use the plain-English descriptions +to generate a report of where the application +conforms to (or fails to meet) the spec:

+
$ rspec --format documentation spec/models/post_spec.rb
+Post
+  before publication
+    cannot have comments
+Failures:
+  1) Post before publication cannot have comments
+     Failure/Error: expect { Post.create.comments.create! }.to raise_error(ActiveRecord::RecordInvalid)
+       expected ActiveRecord::RecordInvalid but nothing was raised
+     # ./spec/models/post.rb:4:in `block (3 levels) in <top (required)>'
+Finished in 0.00527 seconds (files took 0.29657 seconds to load)
+1 example, 1 failure
+Failed examples:
+rspec ./spec/models/post_spec.rb:3 # Post before publication cannot have comments
+
+

For an in-depth look at the RSpec DSL, including lots of examples, +read the official Cucumber documentation for RSpec Core.

+

Helpful Rails Matchers

+

In RSpec, assertions are called expectations, +and every expectation is built around a matcher. +When you expect(a).to eq(b), you’re using the eq matcher.

+

In addition to the matchers that come standard in RSpec, +here are some extras that make it easier +to test the various parts of a Rails system:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RSpec matcherDelegates toAvailable inNotes
be_a_newallprimarily intended for controller specs
render_templateassert_templaterequest / controller / viewuse with expect(response).to
redirect_toassert_redirectrequest / controlleruse with expect(response).to
route_toassert_recognizesrouting / controlleruse with expect(...).to route_to
be_routablerouting / controlleruse with expect(...).not_to be_routable
have_http_statusrequest / controller / feature
match_arrayallfor comparing arrays of ActiveRecord objects
have_been_enqueuedallrequires config: ActiveJob::Base.queue_adapter = :test
have_enqueued_joballrequires config: ActiveJob::Base.queue_adapter = :test
+

Follow the links above for examples of how each matcher is used.

+

What else does RSpec Rails add?

+

For a comprehensive look at RSpec Rails’ features, +read the official Cucumber documentation.

+

What tests should I write?

+

RSpec Rails defines ten different types of specs +for testing different parts of a typical Rails application. +Each one inherits from one of Rails’ built-in TestCase classes, +meaning the helper methods provided by default in Rails tests +are available in RSpec, as well.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Spec typeCorresponding Rails test class
model
controllerActionController::TestCase
mailerActionMailer::TestCase
job
viewActionView::TestCase
routing
helperActionView::TestCase
requestActionDispatch::IntegrationTest
feature
systemActionDispatch::SystemTestCase
+

Follow the links above to see examples of each spec type, +or for official Rails API documentation on the given TestCase class.

+
+

Note: This is not a checklist.

+

Ask a hundred developers how to test an application, +and you’ll get a hundred different answers.

+

RSpec Rails provides thoughtfully selected features +to encourage good testing practices, but there’s no “right” way to do it. +Ultimately, it’s up to you to decide how your test suite will be composed.

+
+

When creating a spec file, +assign it a type in the top-level describe block, like so:

+
# spec/models/user_spec.rb
+RSpec.describe User, type: :model do
+...
+
+

System specs, feature specs, request specs–what’s the difference?

+

RSpec Rails provides some end-to-end (entire application) testing capability +to specify the interaction with the client.

+

System specs

+

Also called acceptance tests, browser tests, or end-to-end tests, +system specs test the application from the perspective of a human client. +The test code walks through a user’s browser interactions,

+
    +
  • visit '/login'
  • +
  • fill_in 'Name', with: 'jdoe'
  • +
+

and the expectations revolve around page content.

+
    +
  • expect(page).to have_text('Welcome')
  • +
+

Because system specs are a wrapper around Rails’ built-in SystemTestCase, +they’re only available on Rails 5.1+. +(Feature specs serve the same purpose, but without this dependency.)

+

Feature specs

+

Before Rails introduced system testing facilities, +feature specs were the only spec type for end-to-end testing. +While the RSpec team now officially recommends system specs instead, +feature specs are still fully supported, look basically identical, +and work on older versions of Rails.

+

On the other hand, feature specs require non-trivial configuration +to get some important features working, +like JavaScript testing or making sure each test runs with a fresh DB state. +With system specs, this configuration is provided out-of-the-box.

+

Like system specs, feature specs require the Capybara gem. +Rails 5.1+ includes it by default as part of system tests, +but if you don’t have the luxury of upgrading, +be sure to add it to the :test group of your Gemfile first:

+
group :test do
+  gem "capybara"
+end
+
+

Request specs

+

Request specs are for testing the application +from the perspective of a machine client. +They begin with an HTTP request and end with the HTTP response, +so they’re faster than feature specs, +but do not examine your app’s UI or JavaScript.

+

Request specs provide a high-level alternative to controller specs. +In fact, as of RSpec 3.5, both the Rails and RSpec teams +discourage directly testing controllers +in favor of functional tests like request specs.

+

When writing them, try to answer the question, +“For a given HTTP request (verb + path + parameters), +what HTTP response should the application return?”

+

Contributing

+ +

Once you’ve cloned the repo and set up the environment, +you can run the specs and Cucumber features, or submit a pull request.

+

See Also

+

RSpec base libraries

+ + + +
+ +
+ + \ No newline at end of file diff --git a/source/documentation/7.1/rspec-rails/js/app.js b/source/documentation/7.1/rspec-rails/js/app.js new file mode 100644 index 000000000..b5610effe --- /dev/null +++ b/source/documentation/7.1/rspec-rails/js/app.js @@ -0,0 +1,344 @@ +(function () { + var localStorage = {}, + sessionStorage = {}; + try { + localStorage = window.localStorage; + } catch (e) {} + try { + sessionStorage = window.sessionStorage; + } catch (e) {} + + function createSourceLinks() { + $(".method_details_list .source_code").before( + "[View source]" + ); + $(".toggleSource").toggle( + function () { + $(this).parent().nextAll(".source_code").slideDown(100); + $(this).text("Hide source"); + }, + function () { + $(this).parent().nextAll(".source_code").slideUp(100); + $(this).text("View source"); + } + ); + } + + function createDefineLinks() { + var tHeight = 0; + $(".defines").after(" more..."); + $(".toggleDefines").toggle( + function () { + tHeight = $(this).parent().prev().height(); + $(this).prev().css("display", "inline"); + $(this).parent().prev().height($(this).parent().height()); + $(this).text("(less)"); + }, + function () { + $(this).prev().hide(); + $(this).parent().prev().height(tHeight); + $(this).text("more..."); + } + ); + } + + function createFullTreeLinks() { + var tHeight = 0; + $(".inheritanceTree").toggle( + function () { + tHeight = $(this).parent().prev().height(); + $(this).parent().toggleClass("showAll"); + $(this).text("(hide)"); + $(this).parent().prev().height($(this).parent().height()); + }, + function () { + $(this).parent().toggleClass("showAll"); + $(this).parent().prev().height(tHeight); + $(this).text("show all"); + } + ); + } + + function searchFrameButtons() { + $(".full_list_link").click(function () { + toggleSearchFrame(this, $(this).attr("href")); + return false; + }); + window.addEventListener("message", function (e) { + if (e.data === "navEscape") { + $("#nav").slideUp(100); + $("#search a").removeClass("active inactive"); + $(window).focus(); + } + }); + + $(window).resize(function () { + if ($("#search:visible").length === 0) { + $("#nav").removeAttr("style"); + $("#search a").removeClass("active inactive"); + $(window).focus(); + } + }); + } + + function toggleSearchFrame(id, link) { + var frame = $("#nav"); + $("#search a").removeClass("active").addClass("inactive"); + if (frame.attr("src") === link && frame.css("display") !== "none") { + frame.slideUp(100); + $("#search a").removeClass("active inactive"); + } else { + $(id).addClass("active").removeClass("inactive"); + if (frame.attr("src") !== link) frame.attr("src", link); + frame.slideDown(100); + } + } + + function linkSummaries() { + $(".summary_signature").click(function () { + document.location = $(this).find("a").attr("href"); + }); + } + + function summaryToggle() { + $(".summary_toggle").click(function (e) { + e.preventDefault(); + localStorage.summaryCollapsed = $(this).text(); + $(".summary_toggle").each(function () { + $(this).text($(this).text() == "collapse" ? "expand" : "collapse"); + var next = $(this).parent().parent().nextAll("ul.summary").first(); + if (next.hasClass("compact")) { + next.toggle(); + next.nextAll("ul.summary").first().toggle(); + } else if (next.hasClass("summary")) { + var list = $('