facemock 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/facemock/user.rb +3 -2
- data/lib/facemock/version.rb +1 -1
- data/spec/facemock/user_spec.rb +18 -1
- data/spec/facemock_spec.rb +1 -1
- metadata +4 -4
data/lib/facemock/user.rb
CHANGED
@@ -10,12 +10,13 @@ module Facemock
|
|
10
10
|
|
11
11
|
def initialize(options={})
|
12
12
|
opts = Hashie::Mash.new(options)
|
13
|
-
|
13
|
+
id = opts.id || opts.identifier
|
14
|
+
@id = (id.to_i > 0) ? id.to_i : ("10000" + (0..9).to_a.shuffle[0..10].join).to_i
|
14
15
|
@name = opts.name || rand(36**10).to_s(36)
|
15
16
|
@email = opts.email || name.gsub(" ", "_") + "@example.com"
|
16
17
|
@password = opts.password || rand(36**10).to_s(36)
|
17
18
|
@installed = opts.installed || false
|
18
|
-
@access_token = opts.access_token ||
|
19
|
+
@access_token = opts.access_token || rand(36**255).to_s(36)
|
19
20
|
app_id = opts.application_id.to_i
|
20
21
|
@application_id = (app_id > 0) ? app_id : nil
|
21
22
|
@created_at = opts.created_at
|
data/lib/facemock/version.rb
CHANGED
data/spec/facemock/user_spec.rb
CHANGED
@@ -99,7 +99,7 @@ describe Facemock::User do
|
|
99
99
|
|
100
100
|
describe '.size' do
|
101
101
|
subject { Facemock::User.new.access_token.size }
|
102
|
-
it { is_expected.to
|
102
|
+
it { is_expected.to be <= 255 }
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -126,6 +126,23 @@ describe Facemock::User do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
# TODO : DOING
|
130
|
+
context 'with identifier option' do
|
131
|
+
before { @opts = { identifier: 100010000000000 } }
|
132
|
+
subject { Facemock::User.new(@opts) }
|
133
|
+
it { is_expected.to be_kind_of Facemock::User }
|
134
|
+
|
135
|
+
describe '.id' do
|
136
|
+
subject { Facemock::User.new(@opts).id }
|
137
|
+
it { is_expected.to eq @opts[:identifier] }
|
138
|
+
end
|
139
|
+
|
140
|
+
describe '.identifier' do
|
141
|
+
subject { Facemock::User.new(@opts).identifier }
|
142
|
+
it { is_expected.to eq @opts[:identifier] }
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
129
146
|
context 'with application_id option but it is not integer' do
|
130
147
|
before { @opts = { application_id: "test_id" } }
|
131
148
|
subject { Facemock::User.new(@opts) }
|
data/spec/facemock_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facemock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09-
|
12
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
@@ -241,7 +241,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
segments:
|
243
243
|
- 0
|
244
|
-
hash:
|
244
|
+
hash: -2277358927019548637
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
none: false
|
247
247
|
requirements:
|
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
250
|
version: '0'
|
251
251
|
segments:
|
252
252
|
- 0
|
253
|
-
hash:
|
253
|
+
hash: -2277358927019548637
|
254
254
|
requirements: []
|
255
255
|
rubyforge_project:
|
256
256
|
rubygems_version: 1.8.25
|