File tree 3 files changed +8
-8
lines changed
3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ def show
32
32
if @meta_image . end_with? '.webp'
33
33
# .webp -> .jpg
34
34
# .webp -> .png
35
- @meta_image . gsub! ( '.webp' , '.jpg' ) if File . exists ? "public/#{ @meta_image [ 0 ..-6 ] } .jpg"
36
- @meta_image . gsub! ( '.webp' , '.jpeg' ) if File . exists ? "public/#{ @meta_image [ 0 ..-6 ] } .jpeg"
37
- @meta_image . gsub! ( '.webp' , '.png' ) if File . exists ? "public/#{ @meta_image [ 0 ..-6 ] } .png"
35
+ @meta_image . gsub! ( '.webp' , '.jpg' ) if File . exist ? "public/#{ @meta_image [ 0 ..-6 ] } .jpg"
36
+ @meta_image . gsub! ( '.webp' , '.jpeg' ) if File . exist ? "public/#{ @meta_image [ 0 ..-6 ] } .jpeg"
37
+ @meta_image . gsub! ( '.webp' , '.png' ) if File . exist ? "public/#{ @meta_image [ 0 ..-6 ] } .png"
38
38
end
39
39
40
40
# Add here if you want to optimize meta description.
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def path
21
21
def exists? ( offset : 0 )
22
22
return false if self . path . include? ( "\u0000 " )
23
23
return false if ( self . id + offset ) . zero?
24
- File . exists ?( "#{ DIR_PATH } /#{ id + offset } .md" )
24
+ File . exist ?( "#{ DIR_PATH } /#{ id + offset } .md" )
25
25
end
26
26
27
27
def cover
Original file line number Diff line number Diff line change 19
19
20
20
context 'offset 省略' do
21
21
before :each do
22
- allow ( File ) . to receive ( :exists ? ) { false }
22
+ allow ( File ) . to receive ( :exist ? ) { false }
23
23
end
24
24
25
25
it 'ファイルあり ⇒ true' do
26
- allow ( File ) . to receive ( :exists ? ) . with ( "public/podcasts/#{ @podcast . id } .md" ) { true }
26
+ allow ( File ) . to receive ( :exist ? ) . with ( "public/podcasts/#{ @podcast . id } .md" ) { true }
27
27
28
28
expect ( @podcast . exists? ) . to eq ( true )
29
29
end
35
35
36
36
context 'offset 指定' do
37
37
before :each do
38
- allow ( File ) . to receive ( :exists ? ) { false }
38
+ allow ( File ) . to receive ( :exist ? ) { false }
39
39
end
40
40
41
41
it 'ファイルあり ⇒ true' do
42
- allow ( File ) . to receive ( :exists ? ) . with ( "public/podcasts/#{ @podcast . id + 1 } .md" ) { true }
42
+ allow ( File ) . to receive ( :exist ? ) . with ( "public/podcasts/#{ @podcast . id + 1 } .md" ) { true }
43
43
44
44
expect ( @podcast . exists? ( offset : 1 ) ) . to eq ( true )
45
45
end
You can’t perform that action at this time.
0 commit comments