traver 0.3.3.1 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -12
- data/lib/traver/object_creator.rb +4 -0
- data/lib/traver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4092521a55e5079f5b08a2a762f0885d70be1ab8
|
4
|
+
data.tar.gz: d3e34c1f4fc799589def2f98259cd6856b92499b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c810bc7ff4b5b3476c70fa0970886bf461aa541424f090e42a53f4ba0383c05dd622c96659620b621d8d4e5471d5fa322a35397c119dbd53368f62bff0c3c3c
|
7
|
+
data.tar.gz: 6dca0376632d41ba7876532406763c228e479e7e923b4a734e16f00304cdadff8b150f6a6f9cd51ed96b9f589c9b1095d8faffb54eb344819fbef3ff609d4031
|
data/README.md
CHANGED
@@ -1,17 +1,7 @@
|
|
1
1
|
# Traver [![Build Status](https://travis-ci.org/yukas/traver.svg?branch=master)](https://travis-ci.org/yukas/traver)
|
2
2
|
|
3
|
-
##
|
4
|
-
|
5
|
-
|
6
|
-
1. Magic values — you don't see there attribute values comes from
|
7
|
-
2. You don't know how the record is setup, because it is not happening in context of the test
|
8
|
-
3. Test data is centarized - if you need to change something, good chance you'll brake a lot of tests
|
9
|
-
4. Hard to maintain — you need to manually change every fixture if your model changes
|
10
|
-
|
11
|
-
## FactoryGirl
|
12
|
-
The problem with the FactoryGirl is that it is complicated. It helps you define almost anything in terms of how complex your data model is. The thing is though — the more complex your factories the more complex seem to be the design of your system. Nobody wants to work with overcomplicated systems.
|
13
|
-
|
14
|
-
We believe that factories should be simple and lightweight just to make it possible to pass validations, everything else should be defined inside the spec itself, so the person who's working with the spec has all the information in place. It is possible with FactoryGirl, but it is too verbose.
|
3
|
+
## Advantages
|
4
|
+
#### Concise syntax
|
15
5
|
|
16
6
|
FactoryGirl:
|
17
7
|
```ruby
|
@@ -25,6 +15,14 @@ Traver:
|
|
25
15
|
FactoryGirl.create(:user, blog: { posts: 2 })
|
26
16
|
```
|
27
17
|
|
18
|
+
#### Ability to setup data inside specs
|
19
|
+
|
20
|
+
Thanks to concise syntax, you're able to setup data inside the spec itself, opposite to factory file. So you see all setup at a glance.
|
21
|
+
|
22
|
+
#### No centralized setup
|
23
|
+
|
24
|
+
As soon as all setup happening in the spec itself, no more braking specs when you change one factory.
|
25
|
+
|
28
26
|
## Installation
|
29
27
|
|
30
28
|
```shell
|
@@ -161,6 +161,10 @@ module Traver
|
|
161
161
|
params_array.map do |params|
|
162
162
|
create_nested_object(factory_name, params)
|
163
163
|
end
|
164
|
+
elsif params_array.first == :__ref__
|
165
|
+
params_array.map do |_|
|
166
|
+
create_nested_object(factory_name, :__ref__)
|
167
|
+
end
|
164
168
|
elsif params_array.first.is_a?(Symbol)
|
165
169
|
params_array.map do |factory_name|
|
166
170
|
create_nested_object(factory_name, {})
|
data/lib/traver/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Kaspervich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|