|
1 | 1 | require 'rails_helper'
|
2 | 2 |
|
3 |
| -RSpec.feature "Podcasts", type: :feature do |
4 |
| - describe "GET documents" do |
5 |
| - scenario "Podcast index should be exist" do |
6 |
| - visit "/podcasts" |
| 3 | +RSpec.feature 'Podcasts', type: :feature do |
| 4 | + describe 'GET documents' do |
| 5 | + scenario 'Podcast index should be exist' do |
| 6 | + visit '/podcasts' |
7 | 7 | expect(page).to have_http_status(:success)
|
8 | 8 | end
|
9 | 9 |
|
10 |
| - scenario "Charter should be exist" do |
11 |
| - visit "/podcasts/1" |
| 10 | + scenario 'Charter should be exist' do |
| 11 | + @soundcloud_track = create(:soundcloud_track) |
| 12 | + allow(@soundcloud_track).to receive(:exists?) { true } |
| 13 | + allow(@soundcloud_track).to receive(:exists?).with(offset: -1) { false } |
| 14 | + allow(@soundcloud_track).to receive(:content) { "title\n収録日: 2019/05/10\n..." } |
| 15 | + allow(SoundCloudTrack).to receive(:find_by).with(id: @soundcloud_track.id.to_s) { @soundcloud_track } |
| 16 | + |
| 17 | + visit "/podcasts/#{@soundcloud_track.id}" |
12 | 18 | target = '← 目次へ'
|
13 | 19 | expect(page).to have_http_status(:success)
|
14 |
| - expect(page).to have_link target, href: "/podcasts" |
| 20 | + expect(page).to have_link target, href: '/podcasts' |
15 | 21 | click_link target
|
16 | 22 | expect(page).to have_http_status(:success)
|
17 | 23 | end
|
18 | 24 |
|
19 |
| - scenario "Load doc file with absolute path" do |
20 |
| - visit "/podcasts/10" |
| 25 | + scenario 'Load doc file with absolute path' do |
| 26 | + @soundcloud_track = create(:soundcloud_track) |
| 27 | + allow(@soundcloud_track).to receive(:exists?) { true } |
| 28 | + allow(@soundcloud_track).to receive(:content) { "title\n収録日: 2019/05/10\n..." } |
| 29 | + allow(SoundCloudTrack).to receive(:find_by).with(id: @soundcloud_track.id.to_s) { @soundcloud_track } |
| 30 | + |
| 31 | + visit "/podcasts/#{@soundcloud_track.id}" |
21 | 32 | target = '目次へ戻る'
|
22 | 33 | expect(page).to have_http_status(:success)
|
23 |
| - expect(page).to have_link target, href: "/podcasts" |
| 34 | + expect(page).to have_link target, href: '/podcasts' |
24 | 35 | click_link target
|
25 | 36 | expect(page).to have_http_status(:success)
|
26 | 37 | end
|
|
0 commit comments