Use ruby 2.x hash syntax
This commit is contained in:
@@ -11,12 +11,12 @@ describe API::PlaylistsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
playlist_1 = FactoryGirl.create(:playlist, :name => 'Playlist 1')
|
||||
playlist_2 = FactoryGirl.create(:playlist, :name => 'Playlist 2')
|
||||
playlist_1 = FactoryGirl.create(:playlist, name: 'Playlist 1')
|
||||
playlist_2 = FactoryGirl.create(:playlist, name: 'Playlist 2')
|
||||
end
|
||||
|
||||
def do_get
|
||||
get :index, :format => :json
|
||||
get :index, format: :json
|
||||
JSON response.body
|
||||
end
|
||||
|
||||
@@ -36,8 +36,8 @@ describe API::PlaylistsController do
|
||||
describe 'POST create' do
|
||||
def do_create
|
||||
post :create,
|
||||
:format => :json,
|
||||
:playlist => FactoryGirl.attributes_for(:playlist)
|
||||
format: :json,
|
||||
playlist: FactoryGirl.attributes_for(:playlist)
|
||||
end
|
||||
|
||||
it 'creates a new playlist for the current user' do
|
||||
|
@@ -5,9 +5,9 @@ describe API::SessionsController do
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
post :create, :format => :json, :session => {
|
||||
:email => user.email,
|
||||
:password => user.password
|
||||
post :create, format: :json, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
|
||||
|
@@ -16,7 +16,7 @@ describe API::TracksController do
|
||||
end
|
||||
|
||||
def do_get
|
||||
get :index, :format => :json
|
||||
get :index, format: :json
|
||||
JSON response.body
|
||||
end
|
||||
|
||||
|
@@ -15,8 +15,8 @@ describe HomeController do
|
||||
end
|
||||
|
||||
it 'assigns latest tracks as @tracks' do
|
||||
track1 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:58:57')
|
||||
track1 = FactoryGirl.create(:track, created_at: '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, created_at: '2011-07-27 19:58:57')
|
||||
get :index
|
||||
assigns[:tracks].should == Track.latest
|
||||
end
|
||||
|
@@ -25,14 +25,14 @@ describe PlaylistsController do
|
||||
describe 'GET edit' do
|
||||
it 'assigns the requested playlist as @playlist' do
|
||||
playlist = FactoryGirl.create(:playlist)
|
||||
get :edit, :id => playlist.id.to_s
|
||||
get :edit, id: playlist.id.to_s
|
||||
assigns[:playlist].should == playlist
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST create' do
|
||||
def do_create
|
||||
post :create, :playlist => FactoryGirl.attributes_for(:playlist)
|
||||
post :create, playlist: FactoryGirl.attributes_for(:playlist)
|
||||
end
|
||||
|
||||
context 'whith valid params' do
|
||||
@@ -44,7 +44,7 @@ describe PlaylistsController do
|
||||
|
||||
it 'redirects to the playlists index' do
|
||||
do_create
|
||||
response.should redirect_to(:action => 'index')
|
||||
response.should redirect_to(action: 'index')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,19 +67,19 @@ describe PlaylistsController do
|
||||
let (:playlist) { FactoryGirl.create(:playlist) }
|
||||
|
||||
def do_update
|
||||
put :update, :id => playlist.id.to_s, :playlist => { :name => 'Rock' }
|
||||
put :update, id: playlist.id.to_s, playlist: { name: 'Rock' }
|
||||
end
|
||||
|
||||
context 'whith valid params' do
|
||||
it 'updates the playlist' do
|
||||
Playlist.any_instance.should_receive(:update_attributes).
|
||||
with({'name' => 'Rock'})
|
||||
Playlist.any_instance.should_receive(:update_attributes)
|
||||
.with({'name' => 'Rock'})
|
||||
do_update
|
||||
end
|
||||
|
||||
it 'redirects to the playlists index' do
|
||||
do_update
|
||||
response.should redirect_to(:action => 'index')
|
||||
response.should redirect_to(action: 'index')
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -11,9 +11,9 @@ describe SessionsController do
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
post :create, :session => {
|
||||
:email => user.email,
|
||||
:password => user.password
|
||||
post :create, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
|
||||
|
@@ -11,12 +11,12 @@ describe SoundsController do
|
||||
let(:sound) { FactoryGirl.create(:sound) }
|
||||
|
||||
def do_show
|
||||
get :show, :id => sound.id
|
||||
get :show, id: sound.id
|
||||
end
|
||||
|
||||
it 'sets the sound file content as the response body' do
|
||||
do_show
|
||||
response.body.should == File.read(sound.path, :encoding => 'BINARY')
|
||||
response.body.should == File.read(sound.path, encoding: 'BINARY')
|
||||
end
|
||||
|
||||
it 'sets the sound mime-type as the response content-type' do
|
||||
|
@@ -10,7 +10,7 @@ describe TracksController do
|
||||
describe 'GET show' do
|
||||
it 'assigns the requested track as @track' do
|
||||
track = FactoryGirl.create(:track)
|
||||
get :show, :id => track.id.to_s
|
||||
get :show, id: track.id.to_s
|
||||
assigns[:track].should == track
|
||||
end
|
||||
end
|
||||
@@ -24,8 +24,8 @@ describe TracksController do
|
||||
|
||||
describe 'POST create new' do
|
||||
def do_create
|
||||
post :create, :track => FactoryGirl.attributes_for(:track).merge({
|
||||
:file => fixture_file_upload(
|
||||
post :create, track: FactoryGirl.attributes_for(:track).merge({
|
||||
file: fixture_file_upload(
|
||||
"#{Rails.root}/spec/fixtures/test.mp3",
|
||||
'audio/mpeg'
|
||||
)
|
||||
|
@@ -12,17 +12,17 @@ describe UsersController do
|
||||
context 'whith valid params' do
|
||||
it 'creates a new user' do
|
||||
expect {
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
post :create, user: FactoryGirl.attributes_for(:user)
|
||||
}.to change(User, :count).by(1)
|
||||
end
|
||||
|
||||
it 'signs the user in' do
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
post :create, user: FactoryGirl.attributes_for(:user)
|
||||
controller.current_user.should_not be_nil
|
||||
end
|
||||
|
||||
it 'redirects to the home page' do
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
post :create, user: FactoryGirl.attributes_for(:user)
|
||||
response.should redirect_to(:root)
|
||||
end
|
||||
end
|
||||
@@ -31,12 +31,12 @@ describe UsersController do
|
||||
before { User.any_instance.stub(:save).and_return(false) }
|
||||
|
||||
it 'assigns the user as @user' do
|
||||
post :create, :user => {}
|
||||
post :create, user: {}
|
||||
assigns[:user].should be_a_new(User)
|
||||
end
|
||||
|
||||
it 'renders the new template' do
|
||||
post :create, :user => {}
|
||||
post :create, user: {}
|
||||
response.should render_template('new')
|
||||
end
|
||||
end
|
||||
|
@@ -1,6 +1,6 @@
|
||||
def build_sound_file
|
||||
file = File.new("#{Rails.root}/spec/fixtures/test.mp3")
|
||||
file.stub(:content_type => 'audio/mpeg')
|
||||
file.stub(content_type: 'audio/mpeg')
|
||||
file
|
||||
end
|
||||
|
||||
|
@@ -8,7 +8,7 @@ feature 'Home page' do
|
||||
end
|
||||
|
||||
scenario 'displays playlists' do
|
||||
playlist = FactoryGirl.create(:playlist, :name => 'Electro')
|
||||
playlist = FactoryGirl.create(:playlist, name: 'Electro')
|
||||
|
||||
visit root_path
|
||||
|
||||
@@ -17,12 +17,12 @@ feature 'Home page' do
|
||||
|
||||
scenario 'displays last track added' do
|
||||
FactoryGirl.create(:track,
|
||||
:name => 'Mega song 1',
|
||||
:created_at => '2011-07-27 19:13:42'
|
||||
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'
|
||||
name: 'Mega song 2',
|
||||
created_at: '2011-07-27 19:58:57'
|
||||
)
|
||||
|
||||
visit root_path
|
||||
|
@@ -8,8 +8,8 @@ feature 'Playlists' do
|
||||
end
|
||||
|
||||
scenario 'lists playlists' do
|
||||
FactoryGirl.create(:playlist, :name => 'Electro')
|
||||
FactoryGirl.create(:playlist, :name => 'Reggae')
|
||||
FactoryGirl.create(:playlist, name: 'Electro')
|
||||
FactoryGirl.create(:playlist, name: 'Reggae')
|
||||
|
||||
visit playlists_path
|
||||
|
||||
@@ -20,7 +20,7 @@ feature 'Playlists' do
|
||||
visit playlists_path
|
||||
|
||||
click_link 'Create playlist'
|
||||
fill_in 'Name', :with => 'Electro'
|
||||
fill_in 'Name', with: 'Electro'
|
||||
click_button 'Create'
|
||||
|
||||
current_path.should == playlists_path
|
||||
@@ -28,11 +28,11 @@ feature 'Playlists' do
|
||||
end
|
||||
|
||||
scenario 'edits playlist' do
|
||||
FactoryGirl.create(:playlist, :name => 'Electro')
|
||||
FactoryGirl.create(:playlist, name: 'Electro')
|
||||
visit playlists_path
|
||||
|
||||
click_link 'Electro'
|
||||
fill_in 'Name', :with => 'Rock'
|
||||
fill_in 'Name', with: 'Rock'
|
||||
click_button 'Save'
|
||||
|
||||
current_path.should == playlists_path
|
||||
|
@@ -8,7 +8,7 @@ feature 'Tracks' do
|
||||
end
|
||||
|
||||
scenario 'shows track' do
|
||||
track = FactoryGirl.create(:track, :name => 'Mega song')
|
||||
track = FactoryGirl.create(:track, name: 'Mega song')
|
||||
|
||||
visit track_path(track)
|
||||
|
||||
@@ -19,7 +19,7 @@ feature 'Tracks' do
|
||||
visit root_path
|
||||
|
||||
click_link 'Add a track'
|
||||
fill_in 'Name', :with => 'Mega song'
|
||||
fill_in 'Name', with: 'Mega song'
|
||||
attach_file 'File', File.expand_path('spec/fixtures/test.mp3')
|
||||
click_button 'Upload'
|
||||
|
||||
|
@@ -11,8 +11,8 @@ feature 'User sign in' do
|
||||
user = FactoryGirl.create(:user)
|
||||
|
||||
visit new_session_path
|
||||
fill_in 'Email', :with => user.email
|
||||
fill_in 'Password', :with => user.password
|
||||
fill_in 'Email', with: user.email
|
||||
fill_in 'Password', with: user.password
|
||||
click_button 'Sign in'
|
||||
|
||||
current_path.should == root_path
|
||||
|
@@ -5,9 +5,9 @@ feature 'User sign up' do
|
||||
|
||||
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
|
||||
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
|
||||
|
@@ -4,9 +4,9 @@ feature 'API sign in' do
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
post api_sessions_path, :format => :json, :session => {
|
||||
:email => user.email,
|
||||
:password => user.password
|
||||
post api_sessions_path, format: :json, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
|
||||
|
@@ -7,9 +7,9 @@ feature 'API cross origin request' do
|
||||
let(:origin) { 'http://origin.example/' }
|
||||
|
||||
background do
|
||||
post sessions_path, :session => {
|
||||
:email => user.email,
|
||||
:password => user.password
|
||||
post sessions_path, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ feature 'API cross origin request' do
|
||||
@integration_session.send(
|
||||
:process,
|
||||
:options,
|
||||
api_playlists_path(:format => :json),
|
||||
api_playlists_path(format: :json),
|
||||
nil,
|
||||
{ 'Origin' => origin }
|
||||
)
|
||||
@@ -32,7 +32,7 @@ feature 'API cross origin request' do
|
||||
|
||||
scenario 'basic request' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(:format => :json), nil, {
|
||||
get api_playlists_path(format: :json), nil, {
|
||||
'Origin' => origin
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ feature 'API cross origin request' do
|
||||
|
||||
scenario 'request without origin' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(:format => :json)
|
||||
get api_playlists_path(format: :json)
|
||||
|
||||
response.headers['Access-Control-Allow-Origin'].should == ''
|
||||
end
|
||||
|
@@ -11,8 +11,8 @@ feature 'API playlists' do
|
||||
playlist = FactoryGirl.attributes_for :playlist
|
||||
|
||||
post api_playlists_path,
|
||||
:format => :json,
|
||||
:playlist => playlist
|
||||
format: :json,
|
||||
playlist: playlist
|
||||
|
||||
json = JSON response.body
|
||||
|
||||
|
@@ -8,20 +8,20 @@ feature 'API tracks' do
|
||||
end
|
||||
|
||||
scenario 'lists tracks' do
|
||||
track_1 = FactoryGirl.create(:track_with_sound, :name => 'Track 1')
|
||||
track_2 = FactoryGirl.create(:track, :name => 'Track 2')
|
||||
track_1 = FactoryGirl.create(:track_with_sound, name: 'Track 1')
|
||||
track_2 = FactoryGirl.create(:track, name: 'Track 2')
|
||||
|
||||
get api_tracks_path, :format => :json
|
||||
get api_tracks_path, format: :json
|
||||
|
||||
response.body.should == [
|
||||
{
|
||||
:id => track_1.id,
|
||||
:name => 'Track 1',
|
||||
:sound_url => api_sound_url(track_1.sound)
|
||||
id: track_1.id,
|
||||
name: 'Track 1',
|
||||
sound_url: api_sound_url(track_1.sound)
|
||||
},
|
||||
{
|
||||
:id => track_2.id,
|
||||
:name => 'Track 2'
|
||||
id: track_2.id,
|
||||
name: 'Track 2'
|
||||
}
|
||||
].to_json
|
||||
end
|
||||
|
@@ -27,8 +27,8 @@ describe Track do
|
||||
describe '#file=' do
|
||||
it 'builds a new related sound with the file' do
|
||||
sounds = double 'sounds association proxy'
|
||||
track.stub(:sounds => sounds)
|
||||
sounds.should_receive(:build).with({:file => file})
|
||||
track.stub(sounds: sounds)
|
||||
sounds.should_receive(:build).with({file: file})
|
||||
track.file = file
|
||||
end
|
||||
end
|
||||
@@ -65,8 +65,8 @@ describe Track do
|
||||
|
||||
describe '.latest' do
|
||||
it 'returns latest tracks in descending creation date order' do
|
||||
track1 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:58:57')
|
||||
track1 = FactoryGirl.create(:track, created_at: '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, created_at: '2011-07-27 19:58:57')
|
||||
Track.latest.should == [track2, track1]
|
||||
end
|
||||
end
|
||||
|
@@ -12,8 +12,8 @@ describe User do
|
||||
it { should_not allow_mass_assignment_of :password_hash }
|
||||
|
||||
context 'when a user with the same email address already exists' do
|
||||
let(:old_user) { FactoryGirl.create(:user, :email => 'unique@example.net') }
|
||||
subject { FactoryGirl.build(:user, :email => old_user.email) }
|
||||
let(:old_user) { FactoryGirl.create(:user, email: 'unique@example.net') }
|
||||
subject { FactoryGirl.build(:user, email: old_user.email) }
|
||||
|
||||
it { should_not be_valid }
|
||||
|
||||
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
||||
|
||||
describe '/api OPTIONS requests routing' do
|
||||
it 'routes to API::ApplicationController#cor_preflight' do
|
||||
{ :options => '/api/some_route' }.should route_to(
|
||||
:controller => 'api/application',
|
||||
:action => 'cor_preflight',
|
||||
:all => 'some_route'
|
||||
{ options: '/api/some_route' }.should route_to(
|
||||
controller: 'api/application',
|
||||
action: 'cor_preflight',
|
||||
all: 'some_route'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@@ -2,17 +2,17 @@ module UserIntegrationHelpers
|
||||
def sign_in
|
||||
user = FactoryGirl.create(:user)
|
||||
visit new_session_path
|
||||
fill_in 'Email', :with => user.email
|
||||
fill_in 'Password', :with => user.password
|
||||
fill_in 'Email', with: user.email
|
||||
fill_in 'Password', with: user.password
|
||||
click_button('Sign in')
|
||||
end
|
||||
|
||||
def api_sign_in
|
||||
user = FactoryGirl.create :user
|
||||
|
||||
post api_sessions_path, :format => :json, :session => {
|
||||
:email => user.email,
|
||||
:password => user.password
|
||||
post api_sessions_path, format: :json, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@@ -3,25 +3,25 @@ require 'spec_helper'
|
||||
describe 'home/index' do
|
||||
before do
|
||||
assign :playlists, [
|
||||
mock_model(Playlist, :name => 'Electro')
|
||||
mock_model(Playlist, name: 'Electro')
|
||||
]
|
||||
assign :tracks, [
|
||||
mock_model(Track, :name => 'Mega song')
|
||||
mock_model(Track, name: 'Mega song')
|
||||
]
|
||||
end
|
||||
|
||||
it 'displays a list of playlists' do
|
||||
render
|
||||
rendered.should have_selector('ul>li', :text => 'Electro')
|
||||
rendered.should have_selector('ul>li', text: 'Electro')
|
||||
end
|
||||
|
||||
it 'displays a link to add a track' do
|
||||
render
|
||||
rendered.should have_selector('a', :text => 'Add a track')
|
||||
rendered.should have_selector('a', text: 'Add a track')
|
||||
end
|
||||
|
||||
it 'displays a list of tracks' do
|
||||
render
|
||||
rendered.should have_selector('ul>li', :text => 'Mega song')
|
||||
rendered.should have_selector('ul>li', text: 'Mega song')
|
||||
end
|
||||
end
|
||||
|
@@ -16,11 +16,11 @@ describe 'playlists/edit' do
|
||||
end
|
||||
|
||||
it 'renders a text field with a label for the playlists name' do
|
||||
playlist.stub(:name => 'Electro')
|
||||
playlist.stub(name: 'Electro')
|
||||
render
|
||||
rendered.should have_selector(
|
||||
"input[type=text][name='playlist[name]'][value=Electro]"
|
||||
)
|
||||
rendered.should have_selector("label[for=playlist_name]", :text => 'Name')
|
||||
rendered.should have_selector("label[for=playlist_name]", text: 'Name')
|
||||
end
|
||||
end
|
||||
|
@@ -3,22 +3,22 @@ require 'spec_helper'
|
||||
describe 'playlists/index' do
|
||||
before do
|
||||
assign :playlists, [
|
||||
mock_model(Playlist, :name => 'Electro')
|
||||
mock_model(Playlist, name: 'Electro')
|
||||
]
|
||||
end
|
||||
|
||||
it 'displays a list of playlists' do
|
||||
render
|
||||
rendered.should have_selector('ul>li', :text => 'Electro')
|
||||
rendered.should have_selector('ul>li', text: 'Electro')
|
||||
end
|
||||
|
||||
it 'displays a link to create a new playlist' do
|
||||
render
|
||||
rendered.should have_selector('a', :text => 'Create playlist')
|
||||
rendered.should have_selector('a', text: 'Create playlist')
|
||||
end
|
||||
|
||||
it 'displays playlists as links' do
|
||||
render
|
||||
rendered.should have_selector('a', :text => 'Electro')
|
||||
rendered.should have_selector('a', text: 'Electro')
|
||||
end
|
||||
end
|
||||
|
@@ -18,11 +18,11 @@ describe 'playlists/new' do
|
||||
end
|
||||
|
||||
it 'renders a text field with a label for the playlists name' do
|
||||
playlist.stub(:name => 'Electro')
|
||||
playlist.stub(name: 'Electro')
|
||||
render
|
||||
rendered.should have_selector(
|
||||
"input[type=text][name='playlist[name]'][value=Electro]"
|
||||
)
|
||||
rendered.should have_selector("label[for=playlist_name]", :text => 'Name')
|
||||
rendered.should have_selector("label[for=playlist_name]", text: 'Name')
|
||||
end
|
||||
end
|
||||
|
@@ -12,7 +12,7 @@ describe 'sessions/new' do
|
||||
it 'renders a text field with a label for the mail address' do
|
||||
render
|
||||
rendered.should have_selector("input[type=text][name='session[email]']")
|
||||
rendered.should have_selector('label[for=session_email]', :text => 'Email')
|
||||
rendered.should have_selector('label[for=session_email]', text: 'Email')
|
||||
end
|
||||
|
||||
it 'renders a password field with a label for the password' do
|
||||
@@ -21,7 +21,7 @@ describe 'sessions/new' do
|
||||
"input[type=password][name='session[password]']"
|
||||
)
|
||||
rendered.should have_selector(
|
||||
'label[for=session_password]', :text => 'Password'
|
||||
'label[for=session_password]', text: 'Password'
|
||||
)
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ describe 'sessions/new' do
|
||||
render
|
||||
rendered.should have_selector(
|
||||
"a[href='#{new_user_path}']",
|
||||
:text => 'Sign up'
|
||||
text: 'Sign up'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@@ -16,18 +16,18 @@ describe 'tracks/new' do
|
||||
end
|
||||
|
||||
it 'renders a text field with a label for the playlists name' do
|
||||
track.stub(:name => 'Mega song')
|
||||
track.stub(name: 'Mega song')
|
||||
render
|
||||
rendered.should have_selector(
|
||||
"input[type=text][name='track[name]'][value='Mega song']"
|
||||
)
|
||||
rendered.should have_selector('label[for=track_name]', :text => 'Name')
|
||||
rendered.should have_selector('label[for=track_name]', text: 'Name')
|
||||
end
|
||||
|
||||
it 'renders a file field with a label for the tracks file' do
|
||||
render
|
||||
rendered.should have_selector("form[enctype='multipart/form-data']")
|
||||
rendered.should have_selector("input[type=file][name='track[file]']")
|
||||
rendered.should have_selector('label[for=track_file]', :text => 'File')
|
||||
rendered.should have_selector('label[for=track_file]', text: 'File')
|
||||
end
|
||||
end
|
||||
|
@@ -9,7 +9,7 @@ describe 'tracks/show' do
|
||||
|
||||
it 'displays the name of the track' do
|
||||
render
|
||||
rendered.should have_selector('h1', :text => 'Mega song')
|
||||
rendered.should have_selector('h1', text: 'Mega song')
|
||||
end
|
||||
|
||||
context 'when track has a sound' do
|
||||
@@ -34,7 +34,7 @@ describe 'tracks/show' do
|
||||
render
|
||||
rendered.should have_selector(
|
||||
'audio',
|
||||
:text => 'Your browser does not support the audio element'
|
||||
text: 'Your browser does not support the audio element'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@@ -21,7 +21,7 @@ describe 'users/new' do
|
||||
"input[type=text][name='user[email]']"
|
||||
)
|
||||
rendered.should have_selector(
|
||||
'label[for=user_email]', :text => 'Email'
|
||||
'label[for=user_email]', text: 'Email'
|
||||
)
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ describe 'users/new' do
|
||||
"input[type=password][name='user[password]']"
|
||||
)
|
||||
rendered.should have_selector(
|
||||
'label[for=user_password]', :text => 'Password'
|
||||
'label[for=user_password]', text: 'Password'
|
||||
)
|
||||
end
|
||||
|
||||
@@ -42,14 +42,14 @@ describe 'users/new' do
|
||||
)
|
||||
rendered.should have_selector(
|
||||
'label[for=user_password_confirmation]',
|
||||
:text => 'Password confirmation'
|
||||
text: 'Password confirmation'
|
||||
)
|
||||
end
|
||||
|
||||
context 'when the user has some validation errors' do
|
||||
it 'on the email address uniqueness' do
|
||||
user = FactoryGirl.create(:user, :email => 'unique@example.net')
|
||||
new_user = FactoryGirl.build(:user, :email => user.email)
|
||||
user = FactoryGirl.create(:user, email: 'unique@example.net')
|
||||
new_user = FactoryGirl.build(:user, email: user.email)
|
||||
new_user.save
|
||||
assign :user, new_user
|
||||
render
|
||||
|
Reference in New Issue
Block a user