-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
172 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Podcasts#edit", type: :feature do | ||
let(:podcast) do | ||
FactoryBot.create(:podcast, title: Faker::ProgrammingLanguage.name, | ||
description: Faker::Markdown.emphasis) | ||
end | ||
|
||
before do | ||
visit edit_podcast_path(podcast) | ||
end | ||
|
||
context 'user sees' do | ||
scenario "the current podcast details in the form" do | ||
expect(page).to have_content("Редактировать Podcast: #{podcast.title}") | ||
|
||
expect(find_field('podcast[title]').value).to eq(podcast.title) | ||
expect(find_field('podcast[description]').value).to eq(podcast.description) | ||
end | ||
|
||
scenario "the form fields for uploading a photo and audio" do | ||
expect(page).to have_field('podcast_photo') | ||
expect(page).to have_field('podcast_audio') | ||
end | ||
|
||
scenario "the back button" do | ||
expect(page).to have_link("Назад", href: podcast_path(podcast)) | ||
end | ||
end | ||
|
||
# context 'user updates the podcast' do | ||
# scenario "successfully updates the podcast title and description" do | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# expect(page).to have_content("Updated Podcast Title") | ||
# expect(page).to have_content("Updated description.") | ||
# end | ||
|
||
# scenario "uploads a new photo" do | ||
# attach_file('podcast[photo]', Rails.root.join('spec/fixtures/files/sample_image.png')) | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# end | ||
|
||
# scenario "uploads a new audio file" do | ||
# attach_file('podcast[audio]', Rails.root.join('spec/fixtures/files/sample_audio.mp3')) | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# end | ||
# end | ||
|
||
# context 'user navigates back' do | ||
# scenario "returns to the podcast show page" do | ||
# click_link "Назад" | ||
# expect(current_path).to eq(podcast_path(podcast)) | ||
# end | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Podcasts#edit", type: :feature do | ||
before do | ||
visit new_podcast_path | ||
end | ||
|
||
context 'user sees' do | ||
scenario "the podcast creation form" do | ||
expect(page).to have_content("Создать Podcast") | ||
expect(page).to have_field('podcast[title]') | ||
expect(page).to have_field('podcast[description]') | ||
expect(page).to have_field('podcast_photo') | ||
expect(page).to have_field('podcast_audio') | ||
end | ||
end | ||
|
||
# context 'user updates the podcast' do | ||
# scenario "successfully updates the podcast title and description" do | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# expect(page).to have_content("Updated Podcast Title") | ||
# expect(page).to have_content("Updated description.") | ||
# end | ||
|
||
# scenario "uploads a new photo" do | ||
# attach_file('podcast[photo]', Rails.root.join('spec/fixtures/files/sample_image.png')) | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# end | ||
|
||
# scenario "uploads a new audio file" do | ||
# attach_file('podcast[audio]', Rails.root.join('spec/fixtures/files/sample_audio.mp3')) | ||
# fill_in 'podcast[title]', with: "Updated Podcast Title" | ||
# fill_in 'podcast[description]', with: "Updated description." | ||
# click_button 'Submit Podcast' | ||
|
||
# expect(page).to have_content("Podcast was successfully updated.") | ||
# end | ||
# end | ||
|
||
# context 'user navigates back' do | ||
# scenario "returns to the podcast show page" do | ||
# click_link "Назад" | ||
# expect(current_path).to eq(podcast_path(podcast)) | ||
# end | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.feature "Podcasts#show", type: :feature do | ||
let(:podcast) do | ||
FactoryBot.create(:podcast, title: Faker::ProgrammingLanguage.name, | ||
description: Faker::Markdown.emphasis) | ||
end | ||
|
||
before do | ||
visit podcast_path(podcast) | ||
end | ||
|
||
context 'user see' do | ||
scenario "podcast details" do | ||
expect(page).to have_content(podcast.title) | ||
expect(page).to have_content(podcast.description) | ||
expect(page).to have_content(podcast.created_at) | ||
end | ||
|
||
scenario "special notice cuz no photo" do | ||
expect(page).to have_selector("div.alert.alert-warning", text: "No Photo Available!") | ||
expect(page).to have_selector("div.alert.alert-warning", text: "No Audio Available!") | ||
end | ||
|
||
scenario "manipulation buttons" do | ||
expect(page).to have_link("Редактировать Podcast", href: edit_podcast_path(podcast)) | ||
expect(page).to have_button("Удалить Podcast") | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe Podcast, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
# pending "add some examples to (or delete) #{__FILE__}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe User, type: :model do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
# pending "add some examples to (or delete) #{__FILE__}" | ||
end |