From fb4ab3e2336079437577465ab122ddb019fd4d30 Mon Sep 17 00:00:00 2001 From: csilvaRuntime Date: Tue, 2 Jul 2024 10:04:38 +0100 Subject: [PATCH] Include shoulda matchers and capybara --- docs/rails/on_boarding/02_rspec/chapter_II.md | 8 +++++++- docs/rails/on_boarding/02_rspec/chapter_IV.md | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 docs/rails/on_boarding/02_rspec/chapter_IV.md diff --git a/docs/rails/on_boarding/02_rspec/chapter_II.md b/docs/rails/on_boarding/02_rspec/chapter_II.md index 6b24597..7a419a5 100644 --- a/docs/rails/on_boarding/02_rspec/chapter_II.md +++ b/docs/rails/on_boarding/02_rspec/chapter_II.md @@ -63,4 +63,10 @@ end Add a validation to the method `publish_if_live` in the Book model which ensures that no publications can be made during the weekends. -Create the necessary specs you seem fit to test this functionality. \ No newline at end of file +Create the necessary specs you seem fit to test this functionality. + +## Shoulda Matchers + +[Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) provides RSpec- one-liners to test common Rails functionality. It helps to eliminate long line of code to make it more straight forward and readable. + +With this in mind use shoulda matchers for any specs you seem fit. diff --git a/docs/rails/on_boarding/02_rspec/chapter_IV.md b/docs/rails/on_boarding/02_rspec/chapter_IV.md new file mode 100644 index 0000000..8ec2da3 --- /dev/null +++ b/docs/rails/on_boarding/02_rspec/chapter_IV.md @@ -0,0 +1,10 @@ +# Chapter IV +`(avr. time for this chapter: TBD)` + +While unit tests verify the correctness of individual units of code in isolation, integration tests ensure that these units work correctly when combined. + +## Capybara + +In the context of RSpec, integration tests are facilitated through tools like [Capybara](https://github.com/teamcapybara/capybara), which allows for simulating user interactions with the application's web interface. + +Create any tests that make sense to test the possible flows.