centric_data_magic 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/ChangeLog +142 -0
- data/Gemfile +14 -0
- data/Guardfile +18 -0
- data/LICENSE +22 -0
- data/README.md +37 -0
- data/RELEASE_NOTES.md +11 -0
- data/Rakefile +27 -0
- data/centric_data_magic.gemspec +28 -0
- data/config/data/default.yml +3 -0
- data/config/data/user.yml +3 -0
- data/creating_gem.md +17 -0
- data/cucumber.yml +2 -0
- data/features/data_magic.feature +134 -0
- data/features/defaults.feature +8 -0
- data/features/step_definitions/data_magic_steps.rb +175 -0
- data/features/support/env.rb +11 -0
- data/features/yaml/another.yml +9 -0
- data/features/yaml/example.yml +65 -0
- data/lib/data_magic/core_ext/hash.rb +7 -0
- data/lib/data_magic/core_ext/integer.rb +13 -0
- data/lib/data_magic/core_ext/string.rb +9 -0
- data/lib/data_magic/date_translation.rb +100 -0
- data/lib/data_magic/standard_translation.rb +370 -0
- data/lib/data_magic/translation.rb +15 -0
- data/lib/data_magic/version.rb +5 -0
- data/lib/data_magic.rb +114 -0
- data/spec/lib/data_magic_spec.rb +113 -0
- data/spec/lib/translation_spec.rb +326 -0
- data/spec/spec_helper.rb +30 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a2512ab8657130771cf019fa1e5426a1221ca4ec717f1f5be4f195e7928e90af
|
4
|
+
data.tar.gz: 2e778fdd4597667da3a354adbb0a9e6e69f51da72c6f389453fb61208cdee399
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fa79799d13c042daf4b24df9eade6a07105ddc3e9297b652bdfd4acd6691946150073ca05a622e60fa58eb1da346a5a510df17b34557cd2145730586794e750
|
7
|
+
data.tar.gz: 414416f1600ccb43ceaf3315419e982aa891c885fe6363d08bb28343fb2bf68d61a555d42fec319d2204650bb5e452b0f8d9e9e5851dc5fb7cd4e070e9836d70
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.1
|
data/ChangeLog
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
== Version 1.2 / 2017-09-23
|
2
|
+
* Enhancements
|
3
|
+
* Data is translated each time a request is made for data (Thanks Vveliev)
|
4
|
+
* Array handling and translation (Thanks Vveliev)
|
5
|
+
|
6
|
+
== Version 1.1 / 2016-08-03
|
7
|
+
* Fixes
|
8
|
+
* Update so it works well on Ruby 2.4 (thanks Robert MacCracken)
|
9
|
+
|
10
|
+
=== Version 1.0 / 2016-11-23
|
11
|
+
* Enhancements
|
12
|
+
* Allow merged to be a Hash of Hashes and find key that matches (thanks Donavan Stanley)
|
13
|
+
* Allow you to specify file to load with tag when using Cucumber (thanks Donavan Stanley)
|
14
|
+
|
15
|
+
=== Version 0.22 / 2015-12-2
|
16
|
+
* Enhancements
|
17
|
+
* Better handling for nexted hash translation (thanks vveliev)
|
18
|
+
|
19
|
+
=== Version 0.21 / 2015-4-12
|
20
|
+
* Enhancements
|
21
|
+
* Added support for locale
|
22
|
+
* Added credit_card_number translator
|
23
|
+
* Added credit_card_type translator
|
24
|
+
|
25
|
+
=== Version 0.20 / 2014-9-21
|
26
|
+
* Enhancements
|
27
|
+
* Added the ability to nest entries under headings
|
28
|
+
* Added the ability to call the translation methods directlry on DataMagic module
|
29
|
+
|
30
|
+
=== Version 0.19 / 2014-6-1
|
31
|
+
* Enhancements
|
32
|
+
* Can now include ERB in the yml file due to update in yml_reader
|
33
|
+
|
34
|
+
=== Version 0.18 / 2014-3-2
|
35
|
+
* Enhancements
|
36
|
+
* Can now set the file to be used by setting a DATA_MAGIC_FILE environment file
|
37
|
+
* Fixes
|
38
|
+
* Only forcing available locales if it is available
|
39
|
+
|
40
|
+
=== Version 0.17 / 2014-1-22
|
41
|
+
* Fixes
|
42
|
+
* Eliminated the deprecation message from I18n
|
43
|
+
|
44
|
+
=== Version 0.16.1 / 2013-9-1
|
45
|
+
* Fixes
|
46
|
+
* Removed pry require
|
47
|
+
|
48
|
+
=== Version 0.16 / 2013-8-31
|
49
|
+
* Enhancements
|
50
|
+
* Ability to support namespaces which will load a file with same name as namespace (Thanks Ben Cullen-Kerney)
|
51
|
+
|
52
|
+
=== Version 0.15.2 / 2013-7-17
|
53
|
+
* Fixes
|
54
|
+
* Display better message when key is not found (Thanks Guillaume Malette)
|
55
|
+
* Properly handling numeric values (Thanks Guillaume Malette)
|
56
|
+
|
57
|
+
=== Version 0.15.1 / 2013-7-11
|
58
|
+
* Fixes
|
59
|
+
* Fixed error when using sequential with entries that have spaces
|
60
|
+
|
61
|
+
=== Version 0.15 / 2013-7-10
|
62
|
+
* Enhancements
|
63
|
+
* Added sequential translator
|
64
|
+
|
65
|
+
=== Version 0.14 / 2013-2-14
|
66
|
+
* Enhancements
|
67
|
+
* Added months_abbr translator
|
68
|
+
* Added day_of_week translator
|
69
|
+
* Added day_of_week_abbr translator
|
70
|
+
* Changed so translator methods are not call after mixing with class
|
71
|
+
|
72
|
+
=== Version 0.13 / 2013-2-7
|
73
|
+
* Enhancements
|
74
|
+
* Added add_translator method to DataMagic to allow custom translators to be added
|
75
|
+
* Added months translator
|
76
|
+
* Added dm_* aliases for all generators
|
77
|
+
|
78
|
+
=== Version 0.12 / 2012-12-28
|
79
|
+
* Enhancements
|
80
|
+
* Added today translator
|
81
|
+
* Added tomorrow translator
|
82
|
+
* Added yesterday translator
|
83
|
+
* Added days_from_today to Fixnum to provide translator
|
84
|
+
* Added days_ago to Fixnum to provide translator
|
85
|
+
|
86
|
+
=== Version 0.11 / 2012-12-22
|
87
|
+
* Enhancements
|
88
|
+
* Added title translator
|
89
|
+
* Added ability for street_address translator to also include secondary address
|
90
|
+
* Added ability for email_address to accept the name portion of the value
|
91
|
+
* Added url translator
|
92
|
+
* Added cell_phone translator
|
93
|
+
* Changed phone_number translator so it does not return an extension
|
94
|
+
|
95
|
+
=== Version 0.10 / 2012-12-8
|
96
|
+
* Enhancements
|
97
|
+
* Added randomize translator to return random selection from Array or Range
|
98
|
+
* Added mask translator which accepts a mask. Will replace # with number, A with upper case letter, and a with lower case letter
|
99
|
+
|
100
|
+
=== Version 0.9 / 2012-8-18
|
101
|
+
* Enhancements
|
102
|
+
* Added name_prefix translator
|
103
|
+
* Added name_suffix translator
|
104
|
+
* Added domain_name translator
|
105
|
+
* Added user_name translator
|
106
|
+
* Added characters translator
|
107
|
+
|
108
|
+
=== Version 0.8 / 2012-6-9
|
109
|
+
* Enhancements
|
110
|
+
* Made yml writable
|
111
|
+
* Updated yml_reader dependency to version 0.2
|
112
|
+
|
113
|
+
=== Version 0.7 / 2012-5-17
|
114
|
+
* Enhancements
|
115
|
+
* Refactored to use yml_reader to remove duplication
|
116
|
+
* Changed default directory from 'config' to 'config/data'
|
117
|
+
* Fixes
|
118
|
+
* Removed unused classes after refactoring
|
119
|
+
|
120
|
+
=== Version 0.6 / 2012-5-4
|
121
|
+
* Fixes
|
122
|
+
* Minor fix so it works properly with ruby 1.8.7
|
123
|
+
|
124
|
+
=== Version 0.5 / 2012-3-24
|
125
|
+
* Enhancements
|
126
|
+
* Added ability to use symbol for the key in the data_for method
|
127
|
+
|
128
|
+
=== Version 0.4 / 2012-2-27
|
129
|
+
* Enhancements
|
130
|
+
* Support for boolean types (thanks jonbettinger)
|
131
|
+
|
132
|
+
=== Version 0.3 / 2012-2-5
|
133
|
+
* Added additional data merge to #data_for
|
134
|
+
|
135
|
+
=== Version 0.2 / 2012-1-26
|
136
|
+
* Defaulted yaml file to 'default.yaml'
|
137
|
+
* Cloned hash so data can be reused
|
138
|
+
* Renamed #name translation method to #full_name
|
139
|
+
* Renamed #email translation method to #email_address
|
140
|
+
|
141
|
+
=== Version 0.1 / 2012-1-21
|
142
|
+
Initial Release
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'http://rubygems.org'
|
4
|
+
|
5
|
+
# gem 'debug'
|
6
|
+
gem 'fuubar'
|
7
|
+
gem 'growl'
|
8
|
+
gem 'guard-cucumber'
|
9
|
+
gem 'guard-rspec'
|
10
|
+
gem 'rake'
|
11
|
+
gem 'rb-fsevent', require: false if RUBY_PLATFORM =~ /darwin/i
|
12
|
+
|
13
|
+
# Specify your gem's dependencies in centric_data_magic.gemspec
|
14
|
+
gemspec
|
data/Guardfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
guard 'rspec', cmd: 'rspec --color --format Fuubar' do
|
7
|
+
watch(%r{^spec/.+_spec\.rb$})
|
8
|
+
watch(%r{^lib/(.+)\.rb$}) { 'spec' }
|
9
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
10
|
+
end
|
11
|
+
|
12
|
+
guard 'cucumber', notification: true, cli: '--profile focus' do
|
13
|
+
watch(%r{^features/.+\.feature$})
|
14
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
15
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
16
|
+
watch(%r{^lib/.+\.rb$}) { 'features' }
|
17
|
+
watch(%r{^features/yaml/.+$}) { 'features' }
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Jeffrey S. Morgan
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Forked from
|
2
|
+
(https://github.com/firstlutfi/data_magic?ref=https://githubhelp.com) because of Faker updates and Data Magic not being maintained. Forked to keep accessibility.
|
3
|
+
|
4
|
+
## How to Use
|
5
|
+
|
6
|
+
Update your Gemfile to
|
7
|
+
|
8
|
+
````ruby
|
9
|
+
gem 'centric_data_magic'
|
10
|
+
````
|
11
|
+
Then run
|
12
|
+
````ruby
|
13
|
+
bundle install
|
14
|
+
````
|
15
|
+
Any other configuration is exactly same as the original gem.
|
16
|
+
|
17
|
+
NOTE:
|
18
|
+
If you have previously used older version of Faker, I suggest you to install [rubocop-faker](https://github.com/koic/rubocop-faker) to automatically update from positional arguments to named arguments.
|
19
|
+
|
20
|
+
## New & Updated Generator
|
21
|
+
|
22
|
+
Here is a list of the new and updated methods:
|
23
|
+
|
24
|
+
| new methods added | updated methods | replaced methods |
|
25
|
+
| --- | --- | --- |
|
26
|
+
| color_hex | job_title<sup>1</sup> | title |
|
27
|
+
| color_name |
|
28
|
+
| number(digits=5, leading_zero=true) |
|
29
|
+
| decimal(before_decimal=5, after_decimal=3) |
|
30
|
+
| merge(separator='_', [first_name, city, number(digits=3)]) |
|
31
|
+
| date_between(from='01/01/2021', to='31/01/2021', format='%d/%m/%Y') |
|
32
|
+
|
33
|
+
<sup>1</sup> In newer version of Faker, Faker::Name.title is changed to Faker::Job.title
|
34
|
+
|
35
|
+
## Copyright
|
36
|
+
|
37
|
+
Copyright (c) 2012-2021 [Jeffrey S. Morgan](https://github.com/cheezy/data_magic). See LICENSE for details.
|
data/RELEASE_NOTES.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# May 2022 Update
|
2
|
+
- Replace `byebug` with `debug` to be compatible with new change
|
3
|
+
- changed name to `centric_data_magic` to use, `gem install centric_data_magic`
|
4
|
+
|
5
|
+
# November 2021
|
6
|
+
## data_magic (updated version)
|
7
|
+
- This gem is ported from the original data_magic gem -> [here](https://github.com/cheezy/data_magic). Please read the original documentation first.
|
8
|
+
I created this to make sure the gem stays updated with its dependencies. (The original gem seems to be unmaintained)
|
9
|
+
- Requirement:
|
10
|
+
- Ruby >= 2.5.1
|
11
|
+
- Faker >= 1.9
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/gem_tasks'
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
require 'cucumber'
|
8
|
+
require 'cucumber/rake/task'
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
11
|
+
spec.ruby_opts = '-I lib:spec'
|
12
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
13
|
+
end
|
14
|
+
task :spec
|
15
|
+
|
16
|
+
Cucumber::Rake::Task.new(:features, 'Run features') do |t|
|
17
|
+
t.profile = 'default'
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Run all specs and cukes'
|
21
|
+
task test: %w[spec features]
|
22
|
+
|
23
|
+
task :lib do
|
24
|
+
$LOAD_PATH.unshift(File.expand_path('lib', File.dirname(__FILE__)))
|
25
|
+
end
|
26
|
+
|
27
|
+
task default: :test
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('lib/data_magic/version', __dir__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'centric_data_magic'
|
7
|
+
gem.version = DataMagic::VERSION
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
gem.authors = ['Jeff Morgan', 'Joseph Ours']
|
10
|
+
gem.email = ['jeff.morgan@leandog.com', 'joseph.ours@centricconsulting.com']
|
11
|
+
gem.license = 'MIT'
|
12
|
+
gem.homepage = 'http://github.com/centricconsulting/centric_data_magic'
|
13
|
+
gem.summary = 'Provides datasets to application via YAML files'
|
14
|
+
gem.description = 'Provides datasets to application stored in YAML files'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.required_ruby_version = '>= 2.7'
|
22
|
+
|
23
|
+
gem.add_dependency 'faker', '>= 1.9'
|
24
|
+
gem.add_dependency 'yml_reader', '>= 0.6'
|
25
|
+
|
26
|
+
gem.add_development_dependency 'cucumber', '>= 1.2.0'
|
27
|
+
gem.add_development_dependency 'rspec', '>= 2.12.0'
|
28
|
+
end
|
data/creating_gem.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Pre-Req
|
2
|
+
- have account at Rubygems
|
3
|
+
|
4
|
+
# Build
|
5
|
+
- change [centric_data_magic.gemspec](centric_data_magic.gemspec) information as needed
|
6
|
+
- change [lib/data_magic/version.rb](lib/data_magic/version.rb) version
|
7
|
+
- run `gem build centric_data_magic` to build the new gem should get output like
|
8
|
+
```bash
|
9
|
+
Successfully built RubyGem
|
10
|
+
Name: centric_data_magic
|
11
|
+
Version: 1.2.2
|
12
|
+
File: centric_data_magic-1.2.2.gem
|
13
|
+
```
|
14
|
+
- make note of the filename
|
15
|
+
|
16
|
+
# Push
|
17
|
+
- Run `gem push centric_data_magic-1.2.2.gem` using filename from above
|
data/cucumber.yml
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
Feature: Functionality of the data_magic gem
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have read the yaml file from features/yaml
|
5
|
+
When I ask for the data for "dm"
|
6
|
+
|
7
|
+
Scenario: Getting basic data from the yaml
|
8
|
+
Then the value for "value1" should be "this is value 1"
|
9
|
+
And the value for "value2" should be "this is value 2"
|
10
|
+
|
11
|
+
Scenario: Getting names from the yaml
|
12
|
+
Then the value for "full_name" should have a minimum of 2 words
|
13
|
+
And the value for "first_name" should be 1 word long
|
14
|
+
And the value for "last_name" should be 1 word long
|
15
|
+
And the value for "name_prefix" should be 1 word long
|
16
|
+
And the value for "name_suffix" should be 1 word long
|
17
|
+
And the value for "job_title" should have a minimum of 1 words
|
18
|
+
|
19
|
+
Scenario: Getting addresses from the yaml
|
20
|
+
Then the value for "street" should have a minimum of 2 words
|
21
|
+
And the value for "street_plus" should have a minimum of 4 words
|
22
|
+
And the value for "city" should have a minimum of 1 word
|
23
|
+
And the value for "state" should have a minimum of 1 word
|
24
|
+
And the value for "state_ab" should be 1 word long
|
25
|
+
And the value for "zip" should be 1 word long
|
26
|
+
And the value for "country" should have a minimum of 1 word
|
27
|
+
And the value for "second_address" should have a minimum of 1 words
|
28
|
+
|
29
|
+
Scenario: Getting a company name from the yaml
|
30
|
+
Then the value for "company" should have a minimum of 1 word
|
31
|
+
|
32
|
+
Scenario: Getting an email address from the yaml
|
33
|
+
Then the value for "email" should be 1 word long
|
34
|
+
And the value for "email_plus" should include "buddy"
|
35
|
+
And the value for "domain_name" should be 1 word long
|
36
|
+
And the value for "user_name" should be 1 word long
|
37
|
+
And the value for "url" should include "http://"
|
38
|
+
|
39
|
+
Scenario: Getting a phone number
|
40
|
+
Then the value for "phone" should be a phone number
|
41
|
+
And the value for "cell" should be a phone number
|
42
|
+
|
43
|
+
Scenario: Random phrases
|
44
|
+
Then the value for "catch_phrase" should exist
|
45
|
+
And the value for "words" should exist
|
46
|
+
And the value for "sentence" should exist
|
47
|
+
And the value for "sentences" should exist
|
48
|
+
And the value for "paragraphs" should exist
|
49
|
+
And the value for "characters" should be 255 characters long
|
50
|
+
|
51
|
+
Scenario: Boolean values
|
52
|
+
Then the value for "bool_true" should be true
|
53
|
+
And the value for "bool_false" should be false
|
54
|
+
|
55
|
+
Scenario: Reading multiple data segments
|
56
|
+
When I ask for the data for "other"
|
57
|
+
Then the value for "name" should be "Cheezy"
|
58
|
+
And the value for "address" should be "123 Main Street"
|
59
|
+
And the value for "email" should be "cheezy@example.com"
|
60
|
+
|
61
|
+
Scenario: Reading from multiple yml files
|
62
|
+
When I load the file "another.yml"
|
63
|
+
And I ask for the data for "other_file"
|
64
|
+
Then the value for "name" should be "Sneezy"
|
65
|
+
And the value for "address" should be "555 Easy Money Drive"
|
66
|
+
And the value for "email" should be "sneezy@example.com"
|
67
|
+
|
68
|
+
Scenario: Reading multiple entries from same file
|
69
|
+
When I load the file "another.yml"
|
70
|
+
And I ask for the data for "other_file"
|
71
|
+
Then the value for "name" should be "Sneezy"
|
72
|
+
When I ask for the data for "more_info"
|
73
|
+
Then the value for "name" should be "Wheezy"
|
74
|
+
And the value for "address" should be "999 Alergy Ave"
|
75
|
+
And the value for "email" should be "wheezy@example.com"
|
76
|
+
|
77
|
+
Scenario: Returning a randomly selected value from an array
|
78
|
+
Then the value for "random" should be either "Tom", "Dick", or "Harry"
|
79
|
+
And the value for "range" should be between 1 and 5
|
80
|
+
|
81
|
+
Scenario: Returning a sequential value from an array
|
82
|
+
Then the first value for the sequential data should be "first"
|
83
|
+
When I ask for the data again
|
84
|
+
Then the second value for the sequential data should be "second"
|
85
|
+
When I ask for the data again
|
86
|
+
Then the third value for the sequential data should be "third"
|
87
|
+
|
88
|
+
Scenario: Returning a value based on a mask
|
89
|
+
Then the value for "mask" should begin with 3 numbers
|
90
|
+
And the value for "mask" should have 3 upper case letters after a dash
|
91
|
+
And the value for "mask" should end with 3 lower case letters
|
92
|
+
|
93
|
+
Scenario: Returning dates
|
94
|
+
Then the value for "today" should be today's date
|
95
|
+
And the value for "tomorrow" should be tomorrow's date
|
96
|
+
And the value for "yesterday" should be yesterday's date
|
97
|
+
|
98
|
+
Scenario: Specifying number of days from today
|
99
|
+
Then the value for "5daysfromtoday" should be five days from today
|
100
|
+
And the value for "5daysago" should be five days ago
|
101
|
+
|
102
|
+
Scenario: Getting a random month name
|
103
|
+
Then the value for "some_month" should be a valid month
|
104
|
+
|
105
|
+
Scenario: Getting a random month abbreviation
|
106
|
+
Then the value for "month_abbr" should be a valid month abbreviation
|
107
|
+
|
108
|
+
Scenario: Getting a random day name
|
109
|
+
Then the value for "some_day" should be a valid day
|
110
|
+
|
111
|
+
Scenario: Getting a random day abbreviation
|
112
|
+
Then the value for "day_abbr" should be a valid day abbreviation
|
113
|
+
|
114
|
+
Scenario: It should allow one to add new translator methods
|
115
|
+
When I add the blah translator
|
116
|
+
Then the value for "blah" should be "foobar"
|
117
|
+
|
118
|
+
Scenario: Getting values from nested entries
|
119
|
+
Then the nested value for this is_nested should be "Nested Value"
|
120
|
+
|
121
|
+
Scenario Outline: Translate values from nested hahs
|
122
|
+
Given overwrite @data with translate_nested
|
123
|
+
Then the nested hash should include <key>
|
124
|
+
And the value for "<key>" should <validate>
|
125
|
+
And the value for "<key>" should not mach <negative_validate>
|
126
|
+
Examples:
|
127
|
+
| key | validate | negative_validate |
|
128
|
+
| full_name | have a minimum of 2 words | ~full_name |
|
129
|
+
| first_name | be 1 word long | ~first_name |
|
130
|
+
|
131
|
+
Scenario: Should be able to call the translator methods on DataMagic module
|
132
|
+
Then I should be able to call the full_name translator
|
133
|
+
And I should be able to call the state translator
|
134
|
+
And I should be able to call the today translator
|
@@ -0,0 +1,8 @@
|
|
1
|
+
Feature: Default file and directory functionality of the data_magic gem
|
2
|
+
|
3
|
+
Scenario: Using the default file and directory
|
4
|
+
Given I have read the default yaml file from the default location
|
5
|
+
When I ask for the data for "dm"
|
6
|
+
Then the value for "value1" should be "this is value 1"
|
7
|
+
And the value for "value2" should be "this is value 2"
|
8
|
+
|