fake_picture 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/fake_picture/version.rb +1 -1
- data/lib/fake_picture.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fb395d9e067b82262beeb3f67ab873ce8a2534a8733dd0d649e914c0837ebe
|
4
|
+
data.tar.gz: 990d2770581c428049724feee5277379621777681aa4742ff55ffab15b22840b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb0458ba394d5ae18c9a8efd02b2205ce97b0071d852561c25ada2547a79bcb115e4bfc0c80118ed658c1dd04fbd068783ecefc30642e740a81b0b510fc279e
|
7
|
+
data.tar.gz: 0730f348a0e877bea1705559372523fc750cef210d1279b3a81c6c57a6ebac2f68b69016c8b29ffbb7e6c3f14e8324f875c2d9757e18e2ea99a4becb357de56e
|
data/README.md
CHANGED
@@ -52,10 +52,10 @@ FakePicture::People.woman #=> /Users/username/workdirectory/fake_picture/lib/
|
|
52
52
|
|
53
53
|
#### As file:
|
54
54
|
|
55
|
-
You can call a method
|
55
|
+
You can also call a method `file` with method name of this class if you wanna get picture as file for some actions, like this:
|
56
56
|
|
57
57
|
```ruby
|
58
|
-
FakePicture::People.
|
58
|
+
FakePicture::People.file(:man) #=> #<File:/Users/xi-master/Workplace/fake_picture/lib/fake_picture/avatar/pack/man-6.svg>
|
59
59
|
```
|
60
60
|
|
61
61
|
#### In factories:
|
@@ -63,7 +63,7 @@ FakePicture::People.man_file #=> /Users/username/workdirectory/fake_picture/l
|
|
63
63
|
```ruby
|
64
64
|
FactoryBot.define do
|
65
65
|
factory :gallery do
|
66
|
-
file { FakePicture::Blog.
|
66
|
+
file { FakePicture::Blog.file(:preview) }
|
67
67
|
end
|
68
68
|
end
|
69
69
|
```
|
@@ -75,7 +75,7 @@ it 'some create user test' do
|
|
75
75
|
post :create, params: {
|
76
76
|
user: {
|
77
77
|
name: 'John',
|
78
|
-
avatar: FakePicture::Avatar.
|
78
|
+
avatar: FakePicture::Avatar.file(:man)
|
79
79
|
}
|
80
80
|
}
|
81
81
|
end
|
@@ -84,7 +84,7 @@ end
|
|
84
84
|
#### In seeds:
|
85
85
|
|
86
86
|
```ruby
|
87
|
-
User.create(name: 'John', avatar: FakePicture::Avatar.
|
87
|
+
User.create(name: 'John', avatar: FakePicture::Avatar.file(:man))
|
88
88
|
```
|
89
89
|
|
90
90
|
## Development
|
data/lib/fake_picture/version.rb
CHANGED
data/lib/fake_picture.rb
CHANGED
@@ -27,9 +27,10 @@ module FakePicture
|
|
27
27
|
self.superclass.random_file("#{path_to_pack + selector}")
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
end
|
31
|
+
|
32
|
+
define_singleton_method :file do |method_name|
|
33
|
+
File.new(self.send(method_name))
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_picture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- loqimean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debug
|