All Projects → baban → flextures

baban / flextures

Licence: MIT license
This plug-in can load and dump test data in databases, loading function is very flexible, dump function is very simple

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to flextures

csv
The csv read/write tool based on java annotation.(基于 java 注解的 CSV 文件读写框架工具。)
Stars: ✭ 22 (+4.76%)
Mutual labels:  csv-export, csv-import
csvlixir
A CSV reading/writing application for Elixir.
Stars: ✭ 32 (+52.38%)
Mutual labels:  csv-export, csv-import
smuggle
Manage exports and imports with ease, separating the logic from the models
Stars: ✭ 30 (+42.86%)
Mutual labels:  csv-export, csv-import
Pytest Mimesis
Mimesis integration with the pytest test runner. This plugin provider useful fixtures based on providers from Mimesis.
Stars: ✭ 46 (+119.05%)
Mutual labels:  fixtures
Babel Test
An opinionated library to make testing babel plugins easier.
Stars: ✭ 79 (+276.19%)
Mutual labels:  fixtures
Goldie
Golden file testing for Go
Stars: ✭ 121 (+476.19%)
Mutual labels:  fixtures
Alicedatafixtures
Nelmio Alice extension to persist the loaded fixtures.
Stars: ✭ 228 (+985.71%)
Mutual labels:  fixtures
Testfixtures
Ruby on Rails like test fixtures for Go. Write tests against a real database
Stars: ✭ 639 (+2942.86%)
Mutual labels:  fixtures
Alice
Expressive fixtures generator
Stars: ✭ 2,289 (+10800%)
Mutual labels:  fixtures
Beanmother
A library for setting up Java objects as test data.
Stars: ✭ 102 (+385.71%)
Mutual labels:  fixtures
Hsac Fitnesse Fixtures
An environment to define and run integration tests. It contains Fitnesse fixture (base) classes and a baseline FitNesse installation.
Stars: ✭ 99 (+371.43%)
Mutual labels:  fixtures
Node Mongodb Fixtures
🍏 Setup and tear down test fixtures with MongoDB.
Stars: ✭ 83 (+295.24%)
Mutual labels:  fixtures
Gonkey
Gonkey - a testing automation tool
Stars: ✭ 162 (+671.43%)
Mutual labels:  fixtures
Wp Cli Fixtures
Easily generate custom fake data for WordPress
Stars: ✭ 65 (+209.52%)
Mutual labels:  fixtures
Foundry
A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
Stars: ✭ 216 (+928.57%)
Mutual labels:  fixtures
Model mommy
No longer maintained, please migrate to model_bakery
Stars: ✭ 929 (+4323.81%)
Mutual labels:  fixtures
Doctrinefixturesbundle
Symfony integration for the doctrine/data-fixtures library
Stars: ✭ 2,174 (+10252.38%)
Mutual labels:  fixtures
Gunit
xUnit-style test fixture adapter for go test
Stars: ✭ 94 (+347.62%)
Mutual labels:  fixtures
Pytest Deadfixtures
Plugin to list unused fixtures in your tests
Stars: ✭ 89 (+323.81%)
Mutual labels:  fixtures
Narwhal
A progressive test framework for C.
Stars: ✭ 110 (+423.81%)
Mutual labels:  fixtures

flextures

Ruby 2.3 higher Rails 4.2 higher MIT Licence

Description

This plug-in aim to resolve many problems, durling rails developping about fixtures. Basic commands is simple. Each commands load or dump fixtures.

rake db:flextures:load
rake db:flextures:dump

Major different point is four.

  1. Fixture file prefered CSV to YAML.
  2. Even if, not match column's structure, loading don't stop and auto padding data.
  3. Fixture file name can change, if file name is not equal table name.
  4. Fixture data can translate to use filter, like factory girl.

Table of Contents

Requirements

  • ruby2.3 higher

Usage

How to install

This program is implemented Rails Plug-in. If You want to install this plug-in. Please use bundler.

In Gemfile

gem "flextures"

And execute below commands.

bundle install
bundle exec rails generate flextures:initializer

(Development emnvoriment must be ruby2.1 higer and rails3 higher)

rake command

load command input fixtures file under "spec/fixtures/". (Loading directory can change configuration file)

rake db:flextures:load
rake db:flextures:dump

rake command can set options. For example, this option set dump file name. (Option dump only "users.csv")

rake db:flextures:dump TABLE=users

Other options...

option description
TABLE set table name
MODEL set model name
DIR set directory name
FILE set fixture file name
FORMAT change dump file format(csv or yml)
OPTION other options
T alias TABLE option
D alias DIR option
F alias FIXTURES option

if you change table colum information next comannd regenerate (load fixture and dump) fixtures

rake db:flextures:generate T=users

Other information please see wiki ...

Unit test support

Fixture load function implemented for Unittes Tools (for example, RSpec, Shoulda).

describe ItemShopController do
  flextures :users, :items
end

flexture function can write like a "fixture" function, implemented in RSpec. But, "flexture" function ignore columns change.

Flextures function can change load file name.

describe ItemShopController do
  flextures :items, :users => :users_for_itemshop # load "users_for_itemshop.csv"
end

Other option information Please see wiki ...

Flextures load & dump filter

load filter

In config/flextures.factory.rb

Factory filter translate fixture data and set database.

For example, this code set current time to last_login_date column.

Flextures::Factory.define :users do |f|
  f.last_login_date = DateTime.now
end

This sample, generate name and sex automatically, and other tables data generate

require 'faker'
Flextures::Factory.define :users do |f|
  f.name= Faker::Name.name if !f.name  # gemerate name
  f.sex= [0,1].shuffle.first if !f.sex # generate sex
  # factory filter can generate data, use has_many association
  f.items<< [ Item.new( master_item_id: 1, count: 5 ), Item.new( master_item_id: 2, count: 3 ) ]
end

dump filter

if you need to convert table data into other data format, you use dump filter. (dump filter is same file as load filter)

dump filter has hash arguments, it is formatted colum name key and convert method, proc, lambda value

file is config/flextures.factory.rb

Flextures::DumpFilter.define :users, {
  :encrypted_password => lambda { |v| Base64.encode64(v) }
}

Other options please see wiki ...

Configuration file

In config/initializers/flextures.rb, configuration file can change load and dump directory

Flextures::Configuration.configure do |config|
  # Load and dump directory change "spec/fixtures/" to "test/fixtures/"
  config.load_directory = "test/fixtures/"
  config.dump_directory = "test/fixtures/"
end

Other options please see wiki ...

Contributing

https://github.com/baban/flextures/graphs/contributors

Licence

This software is released under the MIT Licence.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].