-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
Copy pathpodcasts_spec.rb
40 lines (34 loc) · 1.41 KB
/
podcasts_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'rails_helper'
RSpec.feature 'Podcasts', type: :feature do
describe 'GET documents' do
scenario 'Podcast index should be exist' do
visit '/podcasts'
expect(page).to have_http_status(:success)
end
scenario 'Charter should be exist' do
@podcast = create(:podcast)
allow(@podcast).to receive(:exists?) { true }
allow(@podcast).to receive(:exists?).with(offset: -1) { false }
allow(@podcast).to receive(:content) { "title\n収録日: 2019/05/10\n..." }
allow(Podcast).to receive(:find_by).with(id: @podcast.id.to_s) { @podcast }
visit "/podcasts/#{@podcast.id}"
expect(page).to have_http_status(:success)
target = 'Top'
expect(page).to have_link target, href: podcasts_path
click_link target, match: :first
expect(page).to have_http_status(:success)
end
scenario 'Load doc file with absolute path' do
@podcast = create(:podcast)
allow(@podcast).to receive(:exists?) { true }
allow(@podcast).to receive(:content) { "title\n収録日: 2019/05/10\n..." }
allow(Podcast).to receive(:find_by).with(id: @podcast.id.to_s) { @podcast }
visit "/podcasts/#{@podcast.id}"
target = 'DojoCast'
expect(page).to have_http_status(:success)
expect(page).to have_link target, href: '/podcasts'
click_link target, match: :first
expect(page).to have_http_status(:success)
end
end
end