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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff25f8071c1ca6ce22e590a4b777580455462a79
4
- data.tar.gz: d55354c90fa70805f751911bb7e4eb265c28e180
3
+ metadata.gz: fb33fc76ad2d11424680b76db1d254569252983a
4
+ data.tar.gz: 5e6eff63a88bf36e2de0ab28db7e6ee56dd2ffea
5
5
  SHA512:
6
- metadata.gz: 6ef9572077dd3c9e779d52eebf3479675b127dbaeea21a85c66fdc7fbff7d741e3aa91b5892248359234ecc84b03b39fcda6820c67c9abd171df67d98f328110
7
- data.tar.gz: fa514dc15cd7457f3c64dc0a5358a20d485eae611f4c3b6538a0c13105b510394bd8139922065c75f35bdaf144ebc627c7eb0dadacf4f107238df92d4ffe6e67
6
+ metadata.gz: 8f2d5248626604deee0f59c8debd9d317350831f6e069f10ea0b8a3b325e709a11ce7c989b08ed8868070056d46cd6dbd2cd0234980cf42d51cd4a9b85e04453
7
+ data.tar.gz: 3a3696d44f432555a1365e62824d29d99e68323f72f85dae37d3cdf35f35b226c87a5bdd8926701690a3b7d8db3ad6a292b5ff2f11bd94756e13b512e7cdda59
data/ChangeLog CHANGED
@@ -1,3 +1,9 @@
1
+ === Version 0.21 / 2015-4-12
2
+ * Enhancements
3
+ * Added support for locale
4
+ * Added credit_card_number translator
5
+ * Added credit_card_type translator
6
+
1
7
  === Version 0.20 / 2014-9-21
2
8
  * Enhancements
3
9
  * Added the ability to nest entries under headings
@@ -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
  #
@@ -1,3 +1,3 @@
1
1
  module DataMagic
2
- VERSION = "0.20"
2
+ VERSION = "0.21"
3
3
  end
@@ -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.20'
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: 2014-09-21 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faker