data_magic 0.20 → 0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +6 -0
- data/lib/data_magic.rb +4 -0
- data/lib/data_magic/standard_translation.rb +16 -0
- data/lib/data_magic/version.rb +1 -1
- data/spec/lib/data_magic_spec.rb +6 -0
- data/spec/lib/translation_spec.rb +15 -0
- 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: fb33fc76ad2d11424680b76db1d254569252983a
|
4
|
+
data.tar.gz: 5e6eff63a88bf36e2de0ab28db7e6ee56dd2ffea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2d5248626604deee0f59c8debd9d317350831f6e069f10ea0b8a3b325e709a11ce7c989b08ed8868070056d46cd6dbd2cd0234980cf42d51cd4a9b85e04453
|
7
|
+
data.tar.gz: 3a3696d44f432555a1365e62824d29d99e68323f72f85dae37d3cdf35f35b226c87a5bdd8926701690a3b7d8db3ad6a292b5ff2f11bd94756e13b512e7cdda59
|
data/ChangeLog
CHANGED
data/lib/data_magic.rb
CHANGED
@@ -16,6 +16,10 @@ module DataMagic
|
|
16
16
|
|
17
17
|
I18n.enforce_available_locales = false if I18n.respond_to? :enforce_available_locales
|
18
18
|
|
19
|
+
def self.locale=(value)
|
20
|
+
Faker::Config.locale = value
|
21
|
+
end
|
22
|
+
|
19
23
|
def self.included(cls)
|
20
24
|
@parent = cls
|
21
25
|
translators.each do |translator|
|
@@ -124,6 +124,22 @@ module DataMagic
|
|
124
124
|
end
|
125
125
|
alias_method :dm_catch_phrase, :catch_phrase
|
126
126
|
|
127
|
+
#
|
128
|
+
# return a credit card number
|
129
|
+
#
|
130
|
+
def credit_card_number
|
131
|
+
Faker::Business.credit_card_number
|
132
|
+
end
|
133
|
+
alias_method :dm_credit_card_number, :credit_card_number
|
134
|
+
|
135
|
+
#
|
136
|
+
# return a credit card type
|
137
|
+
#
|
138
|
+
def credit_card_type
|
139
|
+
Faker::Business.credit_card_type
|
140
|
+
end
|
141
|
+
alias_method :dm_credit_card_type, :credit_card_type
|
142
|
+
|
127
143
|
#
|
128
144
|
# return random words - default is 3 words
|
129
145
|
#
|
data/lib/data_magic/version.rb
CHANGED
data/spec/lib/data_magic_spec.rb
CHANGED
@@ -18,6 +18,12 @@ describe DataMagic do
|
|
18
18
|
DataMagic.yml_directory = 'test_dir'
|
19
19
|
expect(DataMagic.yml_directory).to eql 'test_dir'
|
20
20
|
end
|
21
|
+
|
22
|
+
it "should accept and use locale" do
|
23
|
+
expect(Faker::Config).to receive(:locale=).with('blah')
|
24
|
+
DataMagic.locale = 'blah'
|
25
|
+
end
|
26
|
+
|
21
27
|
end
|
22
28
|
|
23
29
|
context "when reading yml files" do
|
@@ -132,6 +132,21 @@ describe "DataMagic translations" do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
context "translating business" do
|
136
|
+
it "should add a credit card number" do
|
137
|
+
expect(Faker::Business).to receive(:credit_card_number).and_return('123')
|
138
|
+
set_field_value '~credit_card_number'
|
139
|
+
expect(example.data_for('key')).to have_field_value '123'
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should add credit card type" do
|
143
|
+
expect(Faker::Business).to receive(:credit_card_type).
|
144
|
+
and_return('visa')
|
145
|
+
set_field_value '~credit_card_type'
|
146
|
+
expect(example.data_for('key')).to have_field_value 'visa'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
135
150
|
context "translating internet names" do
|
136
151
|
it "should add an email address" do
|
137
152
|
expect(Faker::Internet).to receive(:email).and_return('buddy@example.com')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.21'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faker
|