{"id":15659100,"url":"https://github.com/pat/ginger","last_synced_at":"2025-08-15T22:20:18.359Z","repository":{"id":439874,"uuid":"61794","full_name":"pat/ginger","owner":"pat","description":"Run specs/tests multiple times through different gem versions","archived":false,"fork":false,"pushed_at":"2010-09-02T14:28:00.000Z","size":102,"stargazers_count":22,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-05T17:21:24.063Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pat.png","metadata":{"files":{"readme":"README.textile","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":"2008-10-11T08:23:52.000Z","updated_at":"2019-08-13T13:37:45.000Z","dependencies_parsed_at":"2022-08-16T10:25:16.250Z","dependency_job_id":null,"html_url":"https://github.com/pat/ginger","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pat/ginger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fginger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fginger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fginger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fginger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pat","download_url":"https://codeload.github.com/pat/ginger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pat%2Fginger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270637827,"owners_count":24620429,"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-08-15T02:00:12.559Z","response_time":110,"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-03T13:15:00.980Z","updated_at":"2025-08-15T22:20:18.330Z","avatar_url":"https://github.com/pat.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ginger is a small gem that allows you to test your projects using multiple versions of gem libraries. The idea is from \"Ian White's garlic\":http://github.com/ianwhite/garlic/tree - hence the related name of this - but my approach is a bit different, since I don't test my plugins from within a rails application. Maybe they can be merged at some point - I just hacked this up quickly to fit my needs.\n\nTo get it all working, you need to do four things. The first is, of course, to install this gem.\n\n\u003cpre\u003e\u003ccode\u003esudo gem install ginger --source=http://gemcutter.org\u003c/code\u003e\u003c/pre\u003e\n\nNext, add the following line of code to your @spec_helper.rb@ file (or equivalent):\n\n\u003cpre\u003e\u003ccode\u003erequire 'ginger'\u003c/code\u003e\u003c/pre\u003e\n\nYou'll want to put it as high up as possible - in particular, before any @require@ calls to libraries you want to cover multiple versions of.\n\nStep number three is creating the sets of scenarios in a file called @ginger_scenarios.rb@, which should go in the root, spec or test directory of your project. Here's an example, showing off the syntax possibilities.\n\n\u003cpre\u003e\u003ccode\u003erequire 'ginger'\n\nGinger.configure do |config|\n  config.aliases[\"active_record\"] = \"activerecord\"\n  \n  ar_1_2_6 = Ginger::Scenario.new\n  ar_1_2_6[/^active_?record$/] = \"1.15.6\"\n  \n  ar_2_0_2 = Ginger::Scenario.new\n  ar_2_0_2[/^active_?record$/] = \"2.0.2\"\n  \n  ar_2_1_1 = Ginger::Scenario.new\n  ar_2_1_1[/^active_?record$/] = \"2.1.1\"\n  \n  config.scenarios \u003c\u003c ar_1_2_6 \u003c\u003c ar_2_0_2 \u003c\u003c ar_2_1_1\nend\u003c/code\u003e\u003c/pre\u003e\n\nAbove, I've added three different scenarios, for three different versions of ActiveRecord. I also added an alias, as people sometimes use the underscore, and sometimes don't. The gem's name has no underscore though, so the _value_ of the alias matches the gem name (whereas the key would be alternative usage).\n\nYou can have multiple gems set in each scenario - and you don't have to use regular expressions, you can just use straight strings.\n\n\u003cpre\u003e\u003ccode\u003esphinx_scenario = Ginger::Scenario.new\nsphinx_scenario[\"riddle\"] = \"0.9.8\"\nsphinx_scenario[\"thinking_sphinx\"] = \"0.9.8\"\u003c/code\u003e\u003c/pre\u003e\n\nDon't forget to add them to @config@'s scenarios collection, else they're not saved anywhere.\n\nTo better discern different defined scenarios you can create them with a name. The name will be output when the scenario runs as the title. \n\n\u003cpre\u003e\u003ccode\u003esphinx_scenario = Ginger::Scenario.new('Thinking Sphinx 0.9.8')\u003c/code\u003e\u003c/pre\u003e\n\nAnd finally, you'll want to run the tests or specs for each scenario. This is done using the @ginger@ CLI tool, which parrots whatever parameters you give it onto @rake@. So just do something like:\n\n\u003cpre\u003e\u003ccode\u003eginger spec\nginger test\nginger spec:unit\u003c/code\u003e\u003c/pre\u003e\n\nh2. Contributors\n\n* \"Adam Meehan\":http://duckpunching.com/\n* \"Darragh Curran\":http://peelmeagrape.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Fginger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpat%2Fginger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpat%2Fginger/lists"}