Update to rspec 3.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
def build_sound_file
|
||||
file = File.new("#{Rails.root}/spec/fixtures/test.mp3")
|
||||
file.stub(content_type: 'audio/mpeg')
|
||||
file
|
||||
File.new("#{Rails.root}/spec/fixtures/test.mp3").tap do |o|
|
||||
o.define_singleton_method(:content_type) { 'audio/mpeg' }
|
||||
end
|
||||
end
|
||||
|
||||
FactoryGirl.define do
|
||||
|
@@ -1,6 +1,6 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'API sign in' do
|
||||
describe 'API sign in' do
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
@@ -10,7 +10,7 @@ feature 'API sign in' do
|
||||
}
|
||||
end
|
||||
|
||||
scenario 'signs the user in with valid credentials' do
|
||||
it 'signs the user in with valid credentials' do
|
||||
do_create
|
||||
|
||||
expect(response).to be_success
|
||||
@@ -18,7 +18,7 @@ feature 'API sign in' do
|
||||
end
|
||||
|
||||
[:email, :password].each do |attr|
|
||||
scenario "rejects authentication with invalid credentials (#{attr})" do
|
||||
it "rejects authentication with invalid credentials (#{attr})" do
|
||||
allow(user).to receive(attr).and_return(user.send(attr) + '_INVALID')
|
||||
do_create
|
||||
|
||||
|
@@ -1,19 +1,19 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'API cross origin request' do
|
||||
describe 'API cross origin request' do
|
||||
include UserIntegrationHelpers
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
let(:origin) { 'http://origin.example/' }
|
||||
|
||||
background do
|
||||
before do
|
||||
post sessions_path, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
end
|
||||
|
||||
scenario 'preflight request' do
|
||||
it 'responds to preflight request' do
|
||||
@integration_session.send(
|
||||
:process,
|
||||
:options,
|
||||
@@ -30,7 +30,7 @@ feature 'API cross origin request' do
|
||||
.to eq 'Content-Type, Content-Length, X-Requested-With'
|
||||
end
|
||||
|
||||
scenario 'basic request' do
|
||||
it 'responds to basic request' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(format: :json), nil, 'Origin' => origin
|
||||
|
||||
@@ -40,7 +40,7 @@ feature 'API cross origin request' do
|
||||
.to eq 'Content-Length'
|
||||
end
|
||||
|
||||
scenario 'request without origin' do
|
||||
it 'responds to request without origin' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(format: :json)
|
||||
|
||||
|
@@ -1,14 +1,14 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'API playlists' do
|
||||
describe 'API playlists' do
|
||||
include UserIntegrationHelpers
|
||||
|
||||
background { api_sign_in }
|
||||
before { api_sign_in }
|
||||
|
||||
scenario 'creates playlist' do
|
||||
it 'creates playlist' do
|
||||
playlist = FactoryGirl.attributes_for :playlist
|
||||
|
||||
post api_playlists_path,
|
||||
post_via_redirect api_playlists_path,
|
||||
format: :json,
|
||||
playlist: playlist
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
require 'spec_helper'
|
||||
|
||||
feature 'API tracks' do
|
||||
describe 'API tracks' do
|
||||
include UserIntegrationHelpers
|
||||
|
||||
background { api_sign_in }
|
||||
before { api_sign_in }
|
||||
|
||||
scenario 'lists tracks' do
|
||||
it 'lists tracks' do
|
||||
track_1 = FactoryGirl.create(:track_with_sound, name: 'Track 1')
|
||||
track_2 = FactoryGirl.create(:track, name: 'Track 2')
|
||||
|
||||
|
@@ -10,7 +10,7 @@ module UserIntegrationHelpers
|
||||
def api_sign_in
|
||||
user = FactoryGirl.create :user
|
||||
|
||||
post api_sessions_path, format: :json, session: {
|
||||
post_via_redirect api_sessions_path, format: :json, session: {
|
||||
email: user.email,
|
||||
password: user.password
|
||||
}
|
||||
|
Reference in New Issue
Block a user