{"id":15628189,"url":"https://github.com/maprihoda/given_when_then","last_synced_at":"2025-07-27T07:33:41.706Z","repository":{"id":1804890,"uuid":"2728932","full_name":"maprihoda/given_when_then","owner":"maprihoda","description":"Use selected Cucumber-like syntax in your Rspec tests.","archived":false,"fork":false,"pushed_at":"2011-11-21T10:01:19.000Z","size":93,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T23:36:24.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hackday-people/moretrackslikethis.com","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maprihoda.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}},"created_at":"2011-11-07T20:15:21.000Z","updated_at":"2013-10-07T18:38:00.000Z","dependencies_parsed_at":"2022-08-19T13:50:55.032Z","dependency_job_id":null,"html_url":"https://github.com/maprihoda/given_when_then","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maprihoda/given_when_then","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprihoda%2Fgiven_when_then","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprihoda%2Fgiven_when_then/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprihoda%2Fgiven_when_then/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprihoda%2Fgiven_when_then/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maprihoda","download_url":"https://codeload.github.com/maprihoda/given_when_then/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maprihoda%2Fgiven_when_then/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267324368,"owners_count":24069384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-10-03T10:21:21.338Z","updated_at":"2025-07-27T07:33:41.670Z","avatar_url":"https://github.com/maprihoda.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# given_when_then\n\nUse selected Cucumber-like syntax in your Rspec tests.\n\n\n## Installation\n\nIn your Gemfile, under the test group, specify:\n\n    group :test do\n      gem 'given_when_then'\n      # ...\n    end\n\nAnd install with\n\n    bundle\n\n\n## Example Usage\n\nIf you'd love to use the BDD Given-When-Then mantra in your Rspec tests, just use it in place of the describe/it method calls like in this sample integration test:\n\n    describe 'Signing up' do\n      Given 'there is a guest user' do\n        let(:user) { stub('user', :name =\u003e 'Mr XY', :email =\u003e 'xy@example.com', :password =\u003e 'secret' ) }\n\n        When 'he goes to the home page' do\n          before { visit root_path }\n\n          Then 'he should see the navigational links' do\n            page.should have_content 'Sign up or Log in'\n          end\n\n          When 'he clicks the Sign up link' do\n            before { visit signup_path }\n\n            Then 'he should be presented with a signup form' do\n              page.should have_selector 'div[id=\"signup_form\"]'\n            end\n\n            When 'he clicks the Sign up button without filling in his credentials' do\n              Then 'he should see an error message' do\n                click_button 'Sign up'\n                page.should have_content('errors prohibited')\n                User.count.should == 0\n              end\n\n              And 'the path to the form should be the signup_path (see routes.rb)' do\n                current_path.should == signup_path\n              end\n            end\n\n            When 'he fills the form with his credentials and clicks the Sign up button' do\n              before do\n                fill_in 'Name', :with =\u003e user.name\n                fill_in 'Email', :with =\u003e user.email\n                fill_in 'Password', :with =\u003e user.password\n                fill_in 'Confirm Password', :with =\u003e user.password\n                click_button 'Sign up'\n              end\n\n              Then 'he should be signed up successfully' do\n                page.should have_content('Signed up!')\n                current_path.should == root_path\n                User.count.should == 1\n              end\n            end\n          end\n        end\n      end\n    end\n\n\nWhen you run the test with the -fs option, then in the case of success you get'll a nicely formatted output:\n\n    Signing up\n      Given there is a guest user\n        When he visits the home page\n          Then he should see the navigational links\n          When he clicks the Sign up link\n            Then he should be presented with a signup form\n            When he clicks the Sign up button without filling in his credentials\n              Then he should see an error message\n              And the path to the form should be the signup_path (see routes.rb)\n            When he fills the form with his credentials and clicks the Sign up button\n              Then he should be signed up successfully\n\n\nGiven and When are wrappers around Rspec's 'describe', while Then, And and Or wrap Rspec's 'it'.\nThere's no Scenario or Feature because this is Rspec, not Cucumber.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaprihoda%2Fgiven_when_then","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaprihoda%2Fgiven_when_then","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaprihoda%2Fgiven_when_then/lists"}