|
10 | 10 | expect(@podcast.path).to eq("public/podcasts/#{@podcast.id}.md") |
11 | 11 | end |
12 | 12 |
|
13 | | - describe 'exists?(offset: 0)' do |
| 13 | + describe 'exist?(offset: 0)' do |
14 | 14 | it '\u0000 を含む ⇒ false' do |
15 | 15 | allow(@podcast).to receive(:path) { "public/podcasts/\u0000" } |
16 | 16 |
|
17 | | - expect(@podcast.exists?).to eq(false) |
| 17 | + expect(@podcast.exist?).to eq(false) |
18 | 18 | end |
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 | | - expect(@podcast.exists?).to eq(true) |
| 28 | + expect(@podcast.exist?).to eq(true) |
29 | 29 | end |
30 | 30 |
|
31 | 31 | it 'ファイルなし ⇒ false' do |
32 | | - expect(@podcast.exists?).to eq(false) |
| 32 | + expect(@podcast.exist?).to eq(false) |
33 | 33 | end |
34 | 34 | 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 | | - expect(@podcast.exists?(offset: 1)).to eq(true) |
| 44 | + expect(@podcast.exist?(offset: 1)).to eq(true) |
45 | 45 | end |
46 | 46 |
|
47 | 47 | it 'ファイルなし ⇒ false' do |
48 | | - expect(@podcast.exists?(offset: 1)).to eq(false) |
| 48 | + expect(@podcast.exist?(offset: 1)).to eq(false) |
49 | 49 | end |
50 | 50 | end |
51 | 51 | end |
|
57 | 57 | end |
58 | 58 |
|
59 | 59 | it 'ファイル存在 ⇒ ファイルから読み込み' do |
60 | | - allow(@podcast).to receive(:exists?) { true } |
| 60 | + allow(@podcast).to receive(:exist?) { true } |
61 | 61 |
|
62 | 62 | expect(@podcast.content).to eq(@content_body) |
63 | 63 | end |
64 | 64 |
|
65 | 65 | it 'ファイルなし ⇒ 空文字列' do |
66 | | - allow(@podcast).to receive(:exists?) { false } |
| 66 | + allow(@podcast).to receive(:exist?) { false } |
67 | 67 |
|
68 | 68 | expect(@podcast.content).to eq('') |
69 | 69 | end |
|
0 commit comments