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