Remove v0 version namespacing for API
This commit is contained in:
parent
5dfafdcc46
commit
10a8e1f094
@ -1,4 +1,4 @@
|
|||||||
class Api::V0::PlaylistsController < Api::ApplicationController
|
class Api::PlaylistsController < Api::ApplicationController
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
@ -1,4 +1,4 @@
|
|||||||
class Api::V0::SessionsController < Api::ApplicationController
|
class Api::SessionsController < Api::ApplicationController
|
||||||
skip_before_filter :authenticate!, :only => [:create]
|
skip_before_filter :authenticate!, :only => [:create]
|
||||||
|
|
||||||
def create
|
def create
|
@ -1,9 +1,7 @@
|
|||||||
Scube::Application.routes.draw do
|
Scube::Application.routes.draw do
|
||||||
namespace :api do
|
namespace :api do
|
||||||
namespace :v0 do
|
resources :playlists, :only => [:index]
|
||||||
resources :playlists, :only => [:index]
|
resources :sessions, :only => [:create]
|
||||||
resources :sessions, :only => [:create]
|
|
||||||
end
|
|
||||||
|
|
||||||
match '*all' => 'application#cor_preflight', :via => :options
|
match '*all' => 'application#cor_preflight', :via => :options
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Api::V0::PlaylistsController do
|
describe Api::PlaylistsController do
|
||||||
before do
|
before do
|
||||||
controller.current_user = Factory.create(:user)
|
controller.current_user = Factory.create(:user)
|
||||||
end
|
end
|
@ -1,6 +1,6 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Api::V0::SessionsController do
|
describe Api::SessionsController do
|
||||||
describe 'POST create' do
|
describe 'POST create' do
|
||||||
let(:user) { Factory.create(:user) }
|
let(:user) { Factory.create(:user) }
|
||||||
|
|
@ -4,7 +4,7 @@ feature 'API sign in' do
|
|||||||
let(:user) { Factory.create(:user) }
|
let(:user) { Factory.create(:user) }
|
||||||
|
|
||||||
def do_create
|
def do_create
|
||||||
post api_v0_sessions_path, :format => :json, :session => {
|
post api_sessions_path, :format => :json, :session => {
|
||||||
:email => user.email,
|
:email => user.email,
|
||||||
:password => user.password
|
:password => user.password
|
||||||
}
|
}
|
@ -18,7 +18,7 @@ feature 'API cross origin request' do
|
|||||||
# FIXME: request without redirect
|
# FIXME: request without redirect
|
||||||
request_via_redirect(
|
request_via_redirect(
|
||||||
:options,
|
:options,
|
||||||
api_v0_playlists_path(:format => :json),
|
api_playlists_path(:format => :json),
|
||||||
nil,
|
nil,
|
||||||
{ 'Origin' => origin }
|
{ 'Origin' => origin }
|
||||||
)
|
)
|
||||||
@ -33,7 +33,7 @@ feature 'API cross origin request' do
|
|||||||
|
|
||||||
scenario 'basic request' do
|
scenario 'basic request' do
|
||||||
# FIXME: replace with a more stable/generic action
|
# FIXME: replace with a more stable/generic action
|
||||||
get api_v0_playlists_path(:format => :json), nil, {
|
get api_playlists_path(:format => :json), nil, {
|
||||||
'Origin' => origin
|
'Origin' => origin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ require 'spec_helper'
|
|||||||
|
|
||||||
describe '/api OPTIONS requests routing' do
|
describe '/api OPTIONS requests routing' do
|
||||||
it 'routes to Api::ApplicationController#cor_preflight' do
|
it 'routes to Api::ApplicationController#cor_preflight' do
|
||||||
{ :options => '/api/v0' }.should route_to(
|
{ :options => '/api/some_route' }.should route_to(
|
||||||
:controller => 'api/application',
|
:controller => 'api/application',
|
||||||
:action => 'cor_preflight',
|
:action => 'cor_preflight',
|
||||||
:all => 'v0'
|
:all => 'some_route'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user