Update capybara to last version

This commit is contained in:
Thibault Jouan
2014-04-01 05:18:19 +00:00
parent eda2f3fbee
commit 97c64d0990
6 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
require 'spec_helper'
feature 'Home page' do
include UserIntegrationHelpers
background do
sign_in
end
scenario 'displays playlists' do
playlist = FactoryGirl.create(:playlist, :name => 'Electro')
visit root_path
page.should have_content('Electro')
end
scenario 'displays last track added' do
FactoryGirl.create(:track,
:name => 'Mega song 1',
:created_at => '2011-07-27 19:13:42'
)
FactoryGirl.create(:track,
:name => 'Mega song 2',
:created_at => '2011-07-27 19:58:57'
)
visit root_path
page.body.should match(/Mega song 2.+Mega song 1/m)
end
end

View File

@@ -0,0 +1,41 @@
require 'spec_helper'
feature 'Playlists' do
include UserIntegrationHelpers
background do
sign_in
end
scenario 'lists playlists' do
FactoryGirl.create(:playlist, :name => 'Electro')
FactoryGirl.create(:playlist, :name => 'Reggae')
visit playlists_path
page.body.should match(/Electro.+Reggae/m)
end
scenario 'creates playlist' do
visit playlists_path
click_link 'Create playlist'
fill_in 'Name', :with => 'Electro'
click_button 'Create'
current_path.should == playlists_path
page.should have_content('Electro')
end
scenario 'edits playlist' do
FactoryGirl.create(:playlist, :name => 'Electro')
visit playlists_path
click_link 'Electro'
fill_in 'Name', :with => 'Rock'
click_button 'Save'
current_path.should == playlists_path
page.should have_content('Rock')
end
end

View File

@@ -0,0 +1,38 @@
require 'spec_helper'
feature 'Tracks' do
include UserIntegrationHelpers
background do
sign_in
end
scenario 'shows track' do
track = FactoryGirl.create(:track, :name => 'Mega song')
visit track_path(track)
page.should have_content('Mega song')
end
scenario 'creates track' do
visit root_path
click_link 'Add a track'
fill_in 'Name', :with => 'Mega song'
attach_file 'File', File.expand_path('spec/fixtures/test.mp3')
click_button 'Upload'
current_path.should == track_path(Track.find(:first))
page.should have_content('Mega song')
end
scenario 'plays track' do
track = FactoryGirl.create(:track_with_sound)
visit track_path(track)
page.should have_xpath "//audio[@src='#{sound_path(track.sound)}']"
visit find('audio')[:src]
end
end

View File

@@ -0,0 +1,20 @@
require 'spec_helper'
feature 'User sign in' do
scenario 'redirects to the home page when not signed in' do
visit root_path
current_path.should == new_session_path
end
scenario 'signs the user in' do
user = FactoryGirl.create(:user)
visit new_session_path
fill_in 'Email', :with => user.email
fill_in 'Password', :with => user.password
click_button 'Sign in'
current_path.should == root_path
end
end

View File

@@ -0,0 +1,24 @@
require 'spec_helper'
feature 'User sign up' do
let(:user) { FactoryGirl.build(:user) }
background do
visit new_user_path
fill_in 'Email', :with => user.email
fill_in 'Password', :with => user.password
fill_in 'Password confirmation', :with => user.password
end
scenario 'creates the user' do
expect {
click_button 'Sign up'
}.to change(User, :count).by(1)
end
scenario 'redirects to the home page' do
click_button 'Sign up'
current_path.should == root_path
end
end