CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Mon, 18 Aug 2025 08:29:31 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20180611032511
location: https://web.archive.org/web/20180611032511/https://github.com/gregwebs/nested_scenarios
server-timing: captures_list;dur=1.195470, exclusion.robots;dur=0.038834, exclusion.robots.policy;dur=0.017751, esindex;dur=0.018952, cdx.remote;dur=37.445862, LoadShardBlock;dur=389.139222, PetaboxLoader3.datanode;dur=89.063471, PetaboxLoader3.resolve;dur=170.378501
x-app-server: wwwb-app215
x-ts: 302
x-tr: 499
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app215; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Mon, 18 Aug 2025 08:29:32 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: GitHub.com
x-archive-orig-date: Mon, 11 Jun 2018 03:25:11 GMT
x-archive-orig-transfer-encoding: chunked
x-archive-orig-status: 200 OK
x-archive-orig-cache-control: no-cache
x-archive-orig-vary: X-PJAX
x-archive-orig-set-cookie: logged_in=no; domain=.github.com; path=/; expires=Fri, 11 Jun 2038 03:25:11 -0000; secure; HttpOnly
x-archive-orig-set-cookie: _gh_sess=YUovM2dCdU5lbUpWalQ0emJpVGY4aVJBTUkzSTRHbXBDUU92U1Y5ZFphUWFoRkhBODZzR3VUM3NybFZBalJQdlhTQ3FKeG4rKzNHUldQTTJWVDhYbk1NeWsxaVZiSDJXYTgzdXlseHh1MU9GbU1kQUdEaDVUd25WbTRqOEZmdDBMOVd3b1FieDlab2FXQ0laRHFVTVdCUit2TW0zdW1SQTRmNlcyU2dXTzVpczBLVHRvUGkvVm9yRUZKRkF2dFhKcWI4U3pEK3RHeEpjK3dHR1pyKzZOSTZsV2dvaFBLWDJCU3NwRXc2dFduU0d2RnZKNEJDU01FWlZPOC8vM2I0ekNDMytlRzBvbkxvNTV3OXNRSXIrVFdNUmZ0YlJrdkZaamhPeXpvaVpiZVVpT2lkbGRxSDZIQitpM0JLOHFnTHJtQ3IvUXJRWmFndEMwVmRDeEcxWHNtUENyWnBWU1dmTVRsQjE2UGpwUHpLYTJjWkliZ0Q5MjBCVllkWThRTENwTndld042cU5vQ0gzYXg3b3BDT3owcGhuY0lIb0tBM2UrUXcxTTNJS1ZPMD0tLTJQOU01OUlNL2JWenIwTktINTV0a3c9PQ%3D%3D--fe86893fe258bcf646c15e60694083f505a69951; path=/; secure; HttpOnly
x-archive-orig-x-request-id: a61ae69e-c618-4ab5-b744-db6c5ab5e8bc
x-archive-orig-x-runtime: 0.311255
x-archive-orig-strict-transport-security: max-age=31536000; includeSubdomains; preload
x-archive-orig-x-frame-options: deny
x-archive-orig-x-content-type-options: nosniff
x-archive-orig-x-xss-protection: 1; mode=block
x-archive-orig-expect-ct: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
x-archive-orig-content-security-policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; connect-src 'self' uploads.github.com status.github.com collector.githubapp.com api.github.com www.google-analytics.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com wss://live.github.com; font-src assets-cdn.github.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com; img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com; manifest-src 'self'; media-src 'none'; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com
x-archive-orig-x-runtime-rack: 0.319366
x-archive-orig-x-github-request-id: 86CE:57C0:5C0DBC2:A61A541:5B1DEB97
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Mon, 11 Jun 2018 03:25:11 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Mon, 11 Jun 2018 03:25:11 GMT", ; rel="memento"; datetime="Mon, 11 Jun 2018 03:25:11 GMT", ; rel="next memento"; datetime="Sun, 20 Sep 2020 04:22:01 GMT", ; rel="last memento"; datetime="Sun, 20 Sep 2020 04:22:01 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: archiveteam_github_20180704041828/archiveteam_github_20180704041828.megawarc.warc.gz
server-timing: captures_list;dur=0.859790, exclusion.robots;dur=0.034455, exclusion.robots.policy;dur=0.018843, esindex;dur=0.020349, cdx.remote;dur=19.614974, LoadShardBlock;dur=279.365730, PetaboxLoader3.datanode;dur=87.607764, PetaboxLoader3.resolve;dur=274.077822, load_resource;dur=106.920388
x-app-server: wwwb-app215
x-ts: 200
x-tr: 488
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
GitHub - gregwebs/nested_scenarios: FixtureScenarios, FixtureScenariosBuilder, Yaml and Ruby in one big mix for Rails.
Fetching latest commit…
Permalink
gregwebs/nested_scenarios forked from josevalim/nested_scenarios
Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
FixtureScenarios, FixtureScenariosBuilder, Yaml and Ruby in one big mix for Rails.
https://blog.plataformatec.com.br/
Ruby
Clone or download
Launching GitHub Desktop...
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop...
If nothing happens, download GitHub Desktop and try again.
Launching Xcode...
If nothing happens, download Xcode and try again.
Launching Visual Studio...
If nothing happens, download the GitHub extension for Visual Studio and try again.
Pull request
Compare
This branch is 4 commits ahead of josevalim:master.

Cannot retrieve the latest commit at this time.
Failed to load latest commit information. | |||
![]() |
lib | ||
![]() |
tasks | ||
![]() |
.gitignore | ||
![]() |
MIT-LICENSE | ||
![]() |
README | ||
![]() |
Rakefile | ||
![]() |
init.rb | ||
![]() |
nested_scenarios.gemspec |
README
NestedScenarios License: MIT Version: 0.2.2 Description ----------- This plugin is based on FixtureScenarios and FixtureScenarioBuilder. It includes both worlds in just one plugin with some fixes, new features and Rails 2.2 and 2.3 support (check what's new session bellow). You can check them at: NestedScenarios Info: https://josevalim.blogspot.com/ Git : https://github.com/josevalim/nested_scenarios FixtureScenariosBuilder Info: https://errtheblog.com/post/7708 SVN : svn://errtheblog.com/svn/plugins/fixture_scenarios_builder FixtureScenarios Info: https://code.google.com/p/fixture-scenarios/ SVN : https://fixture-scenarios.googlecode.com/svn/trunk/fixture_scenarios Install ------- Install Nested Scenarios is very easy. If you are using Rails 2.3.0, just do: gem sources -a https://gems.github.com sudo gem install josevalim-nested_scenarios If you want it as plugin, just do: script/plugin install git://github.com/josevalim/nested_scenarios.git If you are running on Rails 2.2.x, you should use Nested Scenarios v0.1.1: cd myapp git clone git://github.com/josevalim/nested_scenarios.git cd vendor/plugins/nested_scenarios git checkout v0.1.1 rm -rf ./.git Why? ---- You may, from time to time, wish to build your fixtures entirely in Ruby. Doing so has its advantages, such as automatically created join tables and default attributes. YAML files, however, bring with them some real nice features in Rails which are difficult to abandon: transactional fixtures, table_name(:key) helpers and auto-clearing between tests. This plugin allow to get the best of both worlds. What's new? ----------- FixtureScenario is totally rewritten: it's lighter, smaller and faster. FixtureScenarioBuilder was changed to expose some methods as API and it does not try to guess anymore when you should rebuild your scenarios. You have to call it explicitly using rake db:scenario:build. Finally Rails 2.2 support was also added. Usage ----- Using the +scenario+ method within <tt>scenarios.rb</tt> file, NestedScenarios can create your YAML fixtures automatically at run time. Any file inside the +fixture_path+ called scenario.rb or scenarios.rb is loaded to generating scenarios: [RAILS_ROOT] +-test/ +-fixtures/ +-scenarios.rb Or: [RAILS_ROOT] +-spec/ +-fixtures/ +-models/ +-scenarios.rb +-controllers/ +-scenarios.rb +-helpers/ +-scenarios.rb Now build your scenarios in those files, wrapping scenarios in the +scenario+ method and providing it with the name of your scenario. A brief example of a complete <tt>scenarios.rb</tt> file: scenario :banned_users do %w( Tom Chris Kevin ).each_with_index do |user, index| User.create(:name => user, :banned => index.odd?) end end This will create a file for us: [RAILS_ROOT] +-test/ +-fixtures/ +-banned_users/ +-users.yml Assuming that banned is a boolean field, our generated <tt>users.yml</tt> file will look something like this: chris: name: Chris id: "2" banned: "1" updated_at: 2007-05-09 09:08:04 created_at: 2007-05-09 09:08:04 kevin: name: Kevin id: "3" banned: "0" updated_at: 2007-05-09 09:08:04 created_at: 2007-05-09 09:08:04 tom: name: Tom id: "1" banned: "0" updated_at: 2007-05-09 09:08:04 created_at: 2007-05-09 09:08:04 Notice how the keys correspond to the user names. You can register fields that can be used as fixtures names by: NestedScenarios.record_name_fields += [ "nickname" ] You can also assign your records to instance variables, then call +names_from_ivars!+ at the conclusion of your +scenario+ block. scenario :foo do @small_red_widget = Widget.create(:size => 'small', :color => 'red') @big_blue_widget = Widget.create(:size => 'big', :color => 'blue') names_from_ivars! end The above produces the following YAML: small_red_widget: size: small color: red updated_at: 2007-12-27 10:09:05 created_at: 2007-12-27 10:09:05 big_blue_widget: size: big color: blue updated_at: 2007-12-27 10:19:23 created_at: 2007-12-27 10:19:23 To build the scenario you have to run: rake db:scenario:build NestedScenarios also allows you to nest scenarios: scenario :models => { :users => :banned } do User.create(:name => 'Kevin', :banned => true) end This will create an YAML in the following dir: [RAILS_ROOT] +-test/ +-fixtures/ +-models/ +-users/ +-banned/ +-users.yml Finally, you can choose which scenario to use in your tests by: scenario :users Or, in the case of nested scenarios: scenario :models => { :users => :banned } If no scenario is sent after all, the default behaviour is adopted. Fixtures path ------------- If you have fixtures in your fixtures path root and you want those fixtures to also be loaded, you can configure: class ActiveSupport::TestCase ... self.load_root_fixtures = true ... end You can disable such behaviour in your tests also, by doing: scenario :models => { :users => :banned }, :root => false You just have to remember if you have a scenario with fixtures for a specified table, it will overwrite the fixtures in your root path for the same table. Contributors ------------ * Joe Moore (https://github.com/joemoore) Bugs and Feedback ----------------- If you discover any bugs, please send an e-mail to jose.valim@gmail.com If you just want to give some positive feedback or drop a line, that's fine too! =) Copyright (c) 2009 José Valim https://blog.plataformatec.com.br/
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.