mocker 0.0.1.pre → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -2
- data/lib/locales/en.yml +8 -0
- data/lib/mocker.rb +1 -0
- data/lib/mocker/name.rb +26 -0
- data/lib/mocker/version.rb +1 -1
- data/mocker-0.0.1.pre.gem +0 -0
- data/spec/mocker/name_spec.rb +74 -0
- data/spec/mocker/place_spec.rb +42 -0
- data/spec/mocker_spec.rb +0 -43
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8afc118e93ffcaf4443a23f41c5767e9be79ce2f
|
4
|
+
data.tar.gz: b92d59f4ec8b4dfe635d2a531a32b279bd88d006
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889021ebaec15bb36b7afe73cecc267430f78aee0f3ce1e00de3c9117464d95b886e0f1d14f7457b95205460d777f3c9096c302f25eaef4066807fee29b76faf
|
7
|
+
data.tar.gz: e4926328af9f3d407a6d6f71576621a31926d343423491a8d0200312324c823ec6822e853a5b26ebfc1f29f5dfa6e90f9ca00ad0e7f0ff832d79f7b10d1ed7bd
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Mocker
|
2
2
|
|
3
|
-
|
3
|
+
This gem is a data generation helper.
|
4
|
+
It gives you real data for different types, but from the unusual list of names, just for fun!
|
5
|
+
|
6
|
+
Currently only has locations available. More models will follow.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
@@ -20,7 +23,27 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
## Usage
|
22
25
|
|
23
|
-
|
26
|
+
```ruby
|
27
|
+
require 'mocker'
|
28
|
+
|
29
|
+
# returns one possible place
|
30
|
+
Mocker::Place.name
|
31
|
+
|
32
|
+
# returns a place from the country code passed (e.g. Mocker::Place.name_in 'us')
|
33
|
+
Mocker::Place.name_in <2 letter country code>
|
34
|
+
|
35
|
+
# returns a name of a 'famous person'
|
36
|
+
Mocker::Name.famous_person
|
37
|
+
|
38
|
+
# returns a full name
|
39
|
+
Mocker::Name.full_name gender
|
40
|
+
|
41
|
+
# returns a first name
|
42
|
+
Mocker::Name.first_name gender
|
43
|
+
|
44
|
+
# returns a last name
|
45
|
+
Mocker::Name.last_name
|
46
|
+
```
|
24
47
|
|
25
48
|
## Contributing
|
26
49
|
|
data/lib/locales/en.yml
CHANGED
@@ -36,3 +36,11 @@ en:
|
|
36
36
|
rs: [Varvarin]
|
37
37
|
be: [Waterloo]
|
38
38
|
sl: [Waterloo]
|
39
|
+
names:
|
40
|
+
famous_people: [A, Adolf Lu Hitler Marak, Amor De Cosmos, Brfxxccxxmnpcccclllmmnprxvclmnckssqlbb11116, Christophpher, Jaime Lachica Sin, Depressed Cupboard Cheesecake, Dick Assman, Espen Thoresen Hværsaagod Takkskalduha, Espn, Fifi Trixibelle Geldof, Go Vedge Dot Com, Golden Palace Dot Com, Heavenly Hiraani Tigerlily Hutchence, Ima Hogg, Iuma Dylan-Lucas Thornhill, Jennifer 8 Lee, Jesus Christ, Jon Blake Cusack 2.0, Kentucky Fried Cruelty.com, Lord Daniyaal as-Saadiq al-Amin Salaam u'Allah, Loser Lane, Low Tax, Moxie CrimeFighter Jillette, Nicholas If-Jesus-Had-Not-Died-For-Thee-Thou-Hadst-Been-Damned Barbon, Nigel Freemarijuana, Optimus Prime, Oliver Google Kai, Peaches Honeyblossom Geldof, Picabo Street, Pixie Frou-Frou Geldof, Poppy Petal Emma Elizabeth Deveraux Donahue, Savior God Scientist Allah, States Rights Gist, They, Thursday October Christian, Tuesday Weld, Winner Lane, World B. Free, Yahoo Serious, Yorkshire Bank PLC Are Fascist Bastards, Moon Unit Zappa, Dweezil Zappa, Ahmet Emuukha Rodan Zappa, Diva Magika (nee Muffin) Zappa, Zowie Bowie, Joker Arroyo, God Shammgod, Batman Bin Suparman, Dick Assman]
|
41
|
+
first:
|
42
|
+
female: [Agape, Aggie, Amore, Audi, Cheska, Chia, Cyan, Elowen, Esty, Gitty, Harbor, Harpa, Heavenleigh, Hennessy, Holiday, Hyacinth, Juju, Kapri, Kutty, Lark, Lynix, Mahogany, Melrose, Merci, Monet, Moon, Neo, Nisan, Nivea, Nixon, Pixie, Portia, Posey, Quorra, Rhythm, Royce, Saffron, Salima, Sea, Seneca, Sephora, Sparrow, Stormie, Tempest, Tymber, Violina, Yolo, Zani, Zeek, Zuly]
|
43
|
+
male: [Albin, Anthem, Basil, Bender, Berk, Blayde, Braven, Castle, Charleston, Dagon, Darko, Denim, Dior, Dodge, Elvin, Ember, Eron, Falcon, Finnick, Guru, Hershey, Hilton, Indy, Jhase, Judge, Keats, Koy, Lorde, Matix, Mclean, Moody, Nashton, Onix, Patch, Piers, Ranger, Rexx, Rocko, Roper, Senne, Simba, Tallon, Taro, Tiger, Viggo, Vino, Walden, Wolf, Zealand, Zeppelin]
|
44
|
+
last: [Bacorn, Baldon, Balgobin, Ballinas, Beidleman, Bluett, Boerema, Bogdon, Boran, Brizzi, Caldron, Carrio, Cherny, Cimorelli, Ciresi, Cradle, Crogan, Danger, Daron, Deighan, Depierro, Dethlefs, Dhami, Dimarzo, Dresden, Dromgoole, Faggart, Ficco, Finnicum, Floresca, Gatley, Geltz, Gerrick, Glaspy, Gnau, Granade, Granieri, Guia, Hashagen, Hefel, Holbein, Hollick, Jicha, Jollie, Kathan, Klepacki, Knibbs, Konigsberg, Lagrand, Lienau, Lucado, Malara, Malsam, Manabat, Mehall, Meidl, Midcap, Mitre, Nawabi, Netzley, Newburg, Novell, Parveen, Pianka, Plouff, Posillico, Ransier, Reano, Renbarger, Roskam, Rothery, Rufer, Rumbold, Russey, Sarafian, Schnetzer, Scorsone, Sherriff, Sitterly, Skilton, Sohail, Sonnenfeld, Sookram, Starin, Stavish, Tindol, Trettin, Trueheart, Tuckerman, Tufaro, Vanderweele, Vano, Vinsant, Vlahakis, Vondrasek, Waldroop, Wamboldt, Weppler, Westbay, Yom, Zaveri, Achatz, Anglen, Aquirr, Arscott, Bagent, Balin, Bernales, Bomkamp, Bouthillier, Cavendish, Clyatt, Detienne, Dewbre, Dimuro, Dingledine, Dosh, Droney, Dunklee, Duyck, Emilio, Ence, Eversley, Fetzner, Garofano, Gellis, Gemmer, Grealish, Haertel, Haik, Handyside, Haroutunian, Hornburg, Hurtig, Jenniges, Juncaj, Kallhoff, Kanaan, Kleban, Klontz, Knier, Kopischke, Kugelman, Kuri, Lacoss, Lamarque, Langsdorf, Latouche, Leabo, Lorette, Maracle, Mathus, Mccamy, Merta, Meulemans, Montieth, Muoio, Neyens, Niccoli, Nierenberg, Oberhaus, Oborn, Osorto, Penkala, Podoll, Prenatt, Ramone, Romes, Roupp, Ruscitti, Santaella, Scozzari, Siverling, Speigner, Spinnato, Stentz, Stocke, Sundt, Thorup, Tresch, Tripplett, Uhls, Urdaneta, Uttech, Vosler, Werber, Wieand, Zacharia, Zeleznik, Zoucha, Zuch, Abrell, Agyeman, Aldea, Amodei, Arkwright, Atiyeh, Attig, Aydt, Beed, Bergthold, Blaskowski, Blitzer, Boisselle, Bookhart, Bowns, Bowring, Boyson, Brenning, Brickel, Burcher, Cauldwell, Chappuis, Cleeton, Cordasco, Cosens, Crisan, Curt, Cwikla, Denoble, Denz, Zich]
|
45
|
+
quotes:
|
46
|
+
- Only when a mosquito lands on your testicles, do you truly learn to solve problems without violence
|
data/lib/mocker.rb
CHANGED
data/lib/mocker/name.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Mocker
|
2
|
+
class Name
|
3
|
+
class << self
|
4
|
+
def famous_person
|
5
|
+
I18n.t("names.famous_people").sample
|
6
|
+
end
|
7
|
+
|
8
|
+
def full_name gender=nil
|
9
|
+
"#{first_name gender} #{last_name}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def first_name gender=nil
|
13
|
+
translation="names.first"
|
14
|
+
translation+=".#{gender}" if !gender.nil?
|
15
|
+
|
16
|
+
all_first = I18n.t translation
|
17
|
+
all_first = all_first.values.flatten if all_first.is_a?(Hash)
|
18
|
+
all_first.sample
|
19
|
+
end
|
20
|
+
|
21
|
+
def last_name
|
22
|
+
I18n.t("names.last").sample
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/mocker/version.rb
CHANGED
Binary file
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "byebug"
|
3
|
+
|
4
|
+
describe Mocker::Name do
|
5
|
+
let(:available_names){ I18n.t 'names.famous_people' }
|
6
|
+
let(:female_names) { I18n.t 'names.first.female' }
|
7
|
+
let(:male_names) { I18n.t 'names.first.male' }
|
8
|
+
let(:first_names){
|
9
|
+
female_names + male_names
|
10
|
+
}
|
11
|
+
let(:last_names){ I18n.t 'names.last' }
|
12
|
+
|
13
|
+
describe "famous_person" do
|
14
|
+
it "returns a name of an existing person from the list" do
|
15
|
+
famous_person = Mocker::Name.famous_person
|
16
|
+
expect(available_names).to include famous_person
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "first_name" do
|
21
|
+
it "returns a first name from the list" do
|
22
|
+
first_name = Mocker::Name.first_name
|
23
|
+
expect(first_names).to include first_name
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "last_name" do
|
28
|
+
it "returns a last name from the list" do
|
29
|
+
last_name = Mocker::Name.last_name
|
30
|
+
expect(last_names).to include last_name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "full_name" do
|
35
|
+
it "returns a first name + last name from the list" do
|
36
|
+
full_name = Mocker::Name.full_name
|
37
|
+
name_parts = full_name.split ' '
|
38
|
+
expect(first_names).to include name_parts[0]
|
39
|
+
expect(last_names).to include name_parts[1]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "female_name" do
|
44
|
+
it "returns a female first name and any last name from the list" do
|
45
|
+
female_name = Mocker::Name.full_name("female")
|
46
|
+
name_parts = female_name.split ' '
|
47
|
+
expect(female_names).to include name_parts[0]
|
48
|
+
expect(last_names).to include name_parts[1]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "female_first" do
|
53
|
+
it "returns a female first name from the list" do
|
54
|
+
female_name = Mocker::Name.first_name("female")
|
55
|
+
expect(female_names).to include female_name
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "male_name" do
|
60
|
+
it "returns a male first name and any last name from the list" do
|
61
|
+
male_name = Mocker::Name.full_name("male")
|
62
|
+
name_parts = male_name.split ' '
|
63
|
+
expect(male_names).to include name_parts[0]
|
64
|
+
expect(last_names).to include name_parts[1]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "male_first" do
|
69
|
+
it "returns a male first name from the list" do
|
70
|
+
male_name = Mocker::Name.first_name("male")
|
71
|
+
expect(male_names).to include male_name
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "byebug"
|
3
|
+
|
4
|
+
describe Mocker::Place do
|
5
|
+
let(:available_names){
|
6
|
+
all_countries_places = I18n.t 'places'
|
7
|
+
all_countries_places.values.flatten
|
8
|
+
}
|
9
|
+
|
10
|
+
let(:available_names_in_us){ I18n.t 'places.us' }
|
11
|
+
|
12
|
+
describe "name" do
|
13
|
+
it "returns a name of an existing location, from the list" do
|
14
|
+
random_place = Mocker::Place.name
|
15
|
+
expect(available_names).to include random_place
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "name_in" do
|
20
|
+
describe "when country argument is valid" do
|
21
|
+
describe "when Mocker has a place in that country" do
|
22
|
+
it "returns a name of a place in the argument country" do
|
23
|
+
random_us_place = Mocker::Place.name_in "us"
|
24
|
+
expect(available_names_in_us).to include random_us_place
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "when Mocker does not have a place in that country" do
|
29
|
+
it "throws an inexisting places for country error" do
|
30
|
+
expect {Mocker::Place.name_in "pt"}.to raise_error Mocker::Place::CountryNotFoundError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "when country argument is empty" do
|
36
|
+
it "defaults to Mocker::Place.name" do
|
37
|
+
random_conchichine_place = Mocker::Place.name_in
|
38
|
+
expect(available_names).to include random_conchichine_place
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/mocker_spec.rb
CHANGED
@@ -2,47 +2,4 @@ require "spec_helper"
|
|
2
2
|
require "byebug"
|
3
3
|
|
4
4
|
describe Mocker do
|
5
|
-
let(:available_names){
|
6
|
-
I18n.t 'intialize'
|
7
|
-
translations = I18n.backend.send(:translations)
|
8
|
-
all_countries_places = translations[:en][:places]
|
9
|
-
all_countries_places.values.flatten
|
10
|
-
}
|
11
|
-
|
12
|
-
let(:available_names_in_us){
|
13
|
-
I18n.t 'intialize'
|
14
|
-
translations = I18n.backend.send(:translations)
|
15
|
-
translations[:en][:places][:us]
|
16
|
-
}
|
17
|
-
|
18
|
-
describe "Mocker::Place.name" do
|
19
|
-
it "returns a name of an existing location, from the list" do
|
20
|
-
random_place = Mocker::Place.name
|
21
|
-
expect(available_names).to include random_place
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
describe "Mocker::Place.name_in" do
|
26
|
-
describe "when country argument is valid" do
|
27
|
-
describe "when Mocker has a place in that country" do
|
28
|
-
it "returns a name of a place in the argument country" do
|
29
|
-
random_us_place = Mocker::Place.name_in "us"
|
30
|
-
expect(available_names_in_us).to include random_us_place
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "when Mocker does not have a place in that country" do
|
35
|
-
it "throws an inexisting places for country error" do
|
36
|
-
expect {Mocker::Place.name_in "pt"}.to raise_error Mocker::Place::CountryNotFoundError
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "when country argument is empty" do
|
42
|
-
it "defaults to Mocker::Place.name" do
|
43
|
-
random_conchichine_place = Mocker::Place.name_in
|
44
|
-
expect(available_names).to include random_conchichine_place
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
5
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Baltazar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -98,9 +98,13 @@ files:
|
|
98
98
|
- Rakefile
|
99
99
|
- lib/locales/en.yml
|
100
100
|
- lib/mocker.rb
|
101
|
+
- lib/mocker/name.rb
|
101
102
|
- lib/mocker/place.rb
|
102
103
|
- lib/mocker/version.rb
|
104
|
+
- mocker-0.0.1.pre.gem
|
103
105
|
- mocker.gemspec
|
106
|
+
- spec/mocker/name_spec.rb
|
107
|
+
- spec/mocker/place_spec.rb
|
104
108
|
- spec/mocker_spec.rb
|
105
109
|
- spec/spec_helper.rb
|
106
110
|
homepage: https://github.com/rpbaltazar/mocker
|
@@ -118,15 +122,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
122
|
version: '0'
|
119
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
124
|
requirements:
|
121
|
-
- - "
|
125
|
+
- - ">="
|
122
126
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
127
|
+
version: '0'
|
124
128
|
requirements: []
|
125
129
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.4.
|
130
|
+
rubygems_version: 2.4.3
|
127
131
|
signing_key:
|
128
132
|
specification_version: 4
|
129
133
|
summary: Simple content generator based on real info
|
130
134
|
test_files:
|
135
|
+
- spec/mocker/name_spec.rb
|
136
|
+
- spec/mocker/place_spec.rb
|
131
137
|
- spec/mocker_spec.rb
|
132
138
|
- spec/spec_helper.rb
|