Logo: Relish

  1. Sign in

Project: Ygg

Load and save a simple record from a file

In order to check Ygg's ability to manage record
As a Ygg developer
I want to load and save simple YAML records

Scenarios
Load a basic User record
Given
the class User has the field :name
And
the file "emulations/samples/user.ygg" contains:
- !ruby/object:YggDemo::User 
  name: Xavier Via
When
I load the file and get the records
Then
the first record should be a User
And
it should have the name "Xavier Via"
  • @saves
Save a basic User record
Given
the class User has the field :name
And
I have a user "Catalina" in an array
When
I load the file "emulations/samples/saving.ygg" and add the array to the data
Then
the file should contain:
- !ruby/object:YggDemo::User 
  name: Catalina
Set a base folder and load files with symbols
Given
I have the file "emulations/samples/user.ygg"
When
I set "emulations/samples" as base folder
And
I load :user
Then
I should get non empty data
No block given, no data saved
Given
the class User has the field :name
And
I have the file "emulations/samples/user.ygg"
And
I get its modified date
When
I load it without block
Then
I should get non empty data
And
the file should not have been modified

Last published over 5 years ago by xaviervia.