Sha256: ae58118e2d3f7f803f1266b14df1833a9913cc770b46c44d71f78fc6521fdc22
Contents?: true
Size: 1.36 KB
Versions: 2
Compression:
Stored size: 1.36 KB
Contents
# ToFixture Add `to_fixture` method to Active Record object. Result of `to_fixture` can directly use the fixture files. [![Build Status](https://travis-ci.org/y-yagi/to_fixture.svg?branch=master)](https://travis-ci.org/y-yagi/to_fixture) [![Gem Version](https://badge.fury.io/rb/to_fixture.svg)](http://badge.fury.io/rb/to_fixture) ## Installation Add this line to your application's Gemfile: ```ruby gem 'to_fixture' ``` And then execute: $ bundle Or install it yourself as: $ gem install to_fixture ## Usage ```ruby user = User.create!(name: 'to_fixture', email: 'to_fixture@example.com') puts user.to_fixture # => # users_1: # name: to_fixture # email: to_fixture@example.com ``` If you want to specify a label, pass the label name as an argument. ```ruby puts user.to_fixture("label") # => # label: # name: to_fixture # email: to_fixture@example.com ``` You can also use to `ActiveRecord::Relation`. ```ruby User.create!(name: 'to_fixture_1', email: 'to_fixture1@example.com') User.create!(name: 'to_fixture_2', email: 'to_fixture2@example.com') puts User.all.to_fixture # => # users_980190968: # name: to_fixture_1 # email: to_fixture1@example.com # # users_980190969: # name: to_fixture_2 # email: to_fixture2@example.com ``` ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
to_fixture-0.3.0 | README.md |
to_fixture-0.2.0 | README.md |