{"id":41757265,"url":"https://github.com/coderade/tdd-rails-examples","last_synced_at":"2026-01-25T01:39:47.826Z","repository":{"id":21364750,"uuid":"92245631","full_name":"coderade/tdd-rails-examples","owner":"coderade","description":"This project contains some examples of how use TDD in Ruby on Rails.","archived":false,"fork":false,"pushed_at":"2025-10-01T06:24:17.000Z","size":336,"stargazers_count":5,"open_issues_count":64,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-01T08:35:29.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-05-24T03:26:26.000Z","updated_at":"2025-03-10T16:54:34.000Z","dependencies_parsed_at":"2023-11-11T15:30:56.453Z","dependency_job_id":"ac353e47-f8bf-4e15-8a78-bce7b38cc8fa","html_url":"https://github.com/coderade/tdd-rails-examples","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/coderade/tdd-rails-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderade%2Ftdd-rails-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderade%2Ftdd-rails-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderade%2Ftdd-rails-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderade%2Ftdd-rails-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderade","download_url":"https://codeload.github.com/coderade/tdd-rails-examples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderade%2Ftdd-rails-examples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28741109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T01:25:41.653Z","status":"ssl_error","status_checked_at":"2026-01-25T01:25:34.364Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-25T01:39:47.174Z","updated_at":"2026-01-25T01:39:47.820Z","avatar_url":"https://github.com/coderade.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test-driven Rails with RSpec, Capybara and Cucumber Examples\n\n![Not Maintained](https://img.shields.io/badge/Maintenance%20Level-Not%20Maintained-yellow.svg)\n\n**This project has been developed in 2015 for the purpose of showing some examples of the TDD process with Rails on the version 5 and is not maintained anymore. Some libraries are being updated using the [Dependabot](https://dependabot.com/) and [Snyk.io](https://snyk.io/) services, but no further tests are being done.**\n\n\nThis project contains some examples of how use TDD with Ruby on Rails.\n\n## Used technologies\n\nThe main technologies and Rails gems used in this project are:\n\n### Development\n* [Rails 5](http://rubyonrails.org/) - a web-application framework that includes everything needed to create \ndatabase-backed web applications according to the Model-View-Controller (MVC) pattern.\n* [Devise](https://github.com/plataformatec/devise) - flexible authentication solution for Rails with Warden.   \n* [CarrierWave](https://github.com/carrierwaveuploader/carrierwave) - classier solution for file uploads for Rails,\nSinatra and other Ruby web frameworks.\n* [The Twitter Ruby Gem](https://github.com/sferik/twitter) - a Ruby interface to the Twitter API.\n* [ActiveModelSerializers](https://github.com/rails-api/active_model_serializers) - ActiveModel::Serializer \nimplementation and Rails hooks.\n\n### Testing\n* [Capybara](https://github.com/teamcapybara/capybara) - acceptance test framework for web applications.\n* [Rspec](https://github.com/rspec/rspec-rails) - testing framework for Rails 3.x, 4.x and 5.0.\n* [Cucumber](https://cucumber.io/) - software tool used by computer programmers for testing other software. It runs \nautomated acceptance tests written in a behavior-driven development (BDD) style \n* [Minitest](https://github.com/seattlerb/minitest) - provides a complete suite of testing facilities supporting TDD, \nBDD, mocking, and benchmarking.\n* [Database Cleaner](https://github.com/DatabaseCleaner/database_cleaner) - strategies for cleaning databases in Ruby.\n Can be used to ensure a clean state for testing.\n* [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) - provides RSpec- and Minitest-compatible \none-liners that test common Rails functionality. These tests would otherwise be much longer, more complex\nand error-prone.\n* [vcr](https://github.com/vcr/vcr) - use to record the test suite's HTTP interactions and replay them during future\ntest runs for fast, deterministic and accurate tests.\n* [WebMock](https://github.com/bblimke/webmock) - library for stubbing and setting expectations on HTTP requests in Ruby.\n* [Selenium](https://github.com/SeleniumHQ/selenium) -  tool for writing automated tests of websites. It aims to mimic \nthe behaviour of a real user, and as such interacts with the HTML of the application.\n* [Factory Girl](https://github.com/thoughtbot/factory_girl_rails) - a library for setting up Ruby objects as test data. \n* [Rails Controller Testing](https://github.com/rails/rails-controller-testing) - brings back `assigns` and `assert_template` \nto the Rails tests.  \n\n### Database      \n\nAs this is a simple application that don't need great data persistence. The [SQlite3](https://www.sqlite.org/) has been used \nthat is the default database when a new Ruby on Rails application is created.\n\n##  Examples\n\n### String Cauculator - Simple Red Green Refactor example with Minitest\n\nSimple Red Green Refactor example with Minitest. \n\n###### Test file:\n\n* `string_calculator.rb`=\u003e  [string_calculator.rb](string_calculator.rb)\n\n\n##### Running\n\nTo run, on the root of the project enter:\n\n    ruby string_calculator.rb\n    \n### RSpec examples\n\nThere is many RSpec examples testing examples on this project, for instance 79 specs. All they are running with success.\n\nTo run all the specs on the root of the project enter `rspec`.\n\n\u003e There are three specs failing, they are related with the Third API testing with Twitter.\n\n#### Playground - Simple RSpec example\n\nSimple example with RSpec.\n\n\nSee the following files for a better understanding:\n\n###### Spec file:\n\n* `playground_spec.rb`=\u003e  [playground_spec.rb](spec/playground_spec.rb) \n\n###### Support files:\n\n* `playground.rb` =\u003e  [lib/playground.rb](lib/playground.rb)\n\n    \n##### Running\n\nTo run this spec, on the root of the project enter:\n\n    rspec spec/playground_spec.rb \n\n\n#### Bowling Game - Advanced RSpec example\n\nMore complex example with RSpec based on a bowling game. \n\n\nSee the following files for a better understanding:\n\n###### Spec file:\n\n* `bowling_game_spec.rb`=\u003e  [bowling_game_spec.rb](spec/bowling_game_spec.rb)\n\n###### Support files:\n\n* `bowling_game.rb` =\u003e  [lib/bowling_game.rb](lib/bowling_game.rb)\n\n    \n##### Running\n\nTo run this spec, on the root of the project enter:\n\n    rspec spec/bowling_game_spec.rb \n\n\n#### Create Achievement spec\n\nSpec testing the achievement creation, authentication and authorization.\n\nSee the following files for a better understanding:\n\n###### Spec file:\n\n* `create_achievement_spec.rb`=\u003e  [spec/create_achievement_spec.rb](spec/create_achievement_spec.rb)\n\n###### Support files:\n* `login_form.rb` =\u003e  [spec/support/login_form.rb](spec/support/login_form.rb)\n* `new_achievement_form.rb` =\u003e  [spec/support/new_achievement_form.rb](spec/support/new_achievement_form.rb)\n\n###### Factory files:\n* `achievements.rb` =\u003e  [spec/factories/achievements.rb](spec/factories/achievements.rb) \n* `users.rb` =\u003e  [spec/factories/users.rb](spec/factories/users.rb) \n    \n##### Running\n\nTo run this spec, on the root of the project enter:\n\n    rspec spec/create_achievement_spec.rb \n\n\u003e This spec is failing, the fail is related with the Third API testing with Twitter.\n\n\n\n#### Achievements Controller spec\n\nSpec testing the Achievement controller, more specifically your CRUD operations like show, create, update, edit and destroy \nmethods in addition to authentication and authorization.\n\nSee the following files for a better understanding:\n\n###### Spec file:\n\n* `achievements_controller_spec.rb`=\u003e  [spec/controllers/achievements_controller_spec.rb](spec/controllers/achievements_controller_spec.rb)\n\n###### Controller\n\n* `achievements_controller.rb`=\u003e  [app/controllers/achievements_controller.rb](app/controllers/achievements_controller.rb)\n\n###### Support files:\n* `login_form.rb` =\u003e  [spec/support/login_form.rb](spec/support/login_form.rb)\n* `new_achievement_form.rb` =\u003e  [spec/support/new_achievement_form.rb](spec/support/new_achievement_form.rb)\n\n###### Factory files:\n* `achievements.rb` =\u003e  [spec/factories/achievements.rb](spec/factories/achievements.rb) \n* `users.rb` =\u003e  [spec/factories/users.rb](spec/factories/users.rb) \n    \n##### Running\n\nTo run this spec, on the root of the project enter:\n\n    rspec spec/controllers/encouragements_controller_spec.rb \n\n\n#### Achievements Model spec\n\nSpec testing the Achievement model, more specifically the validations, associations, instance methods, db queries  using\nsome helpers like the Shoulda-matchers Gem.\n\nSee the following files for a better understanding:\n\n###### Spec file:\n\n* `achievement_spec.rb`=\u003e  [spec/models/achievement_spec.rb](spec/models/achievement_spec.rb)\n\n###### Model\n\n* `achievement.rb`=\u003e  [app/models/achievement.rb](app/models/achievement.rb)\n\n###### Factory files:\n* `achievements.rb` =\u003e  [spec/factories/achievements.rb](spec/factories/achievements.rb) \n* `users.rb` =\u003e  [spec/factories/users.rb](spec/factories/users.rb) \n    \n##### Running\n\nTo run this spec, on the root of the project enter:\n\n    rspec spec/models/achievement_spec.rb\n    \n\n### Isolation Tests\n\nThere are some isolation tests examples using the Mock and Stubs concepts created on the \n[mock-and-stubs](https://github.com/coderade/tdd-rails-examples/tree/mocks-and-stubs) branch.\n\nFor more information see: [Isolation tests examples](https://github.com/coderade/tdd-rails-examples/tree/mocks-and-stubs#isolation-testing-examples-with-rspec)\n\n### Cucumber examples\n\n#### Reading other achievements feature\n\nExample of a feature with Cucumber testing if a guest user can read other achievements.\n\nSee the following files for a better understanding:\n\n###### Feature file:\n\n* `achievement_page.feature`=\u003e  [features/achievement_page.feature](features/achievement_page.feature)\n\n###### Support file:\n* `achievements_steps.rb`=\u003e  [features/step_definitions/achievements_steps.rb](features/step_definitions/achievements_steps.rb)\n\n\n##### Running\n\nTo run this feature, on the root of the project enter:\n\n    rails cucumber\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderade%2Ftdd-rails-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderade%2Ftdd-rails-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderade%2Ftdd-rails-examples/lists"}