Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fixes #104] Record examples considers a defined resource_id
- Loading branch information
1 parent
ce58bd6
commit 6d61c5a
Showing
4 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ spec/dummy/tmp/ | |
.idea | ||
Gemfile.lock | ||
.rvmrc | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
spec/controllers/api/v2/nested/resources_controller_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe Api::V2::Nested::ResourcesController do | ||
describe "resource id" do | ||
subject { Apipie.get_resource_name(Api::V2::Nested::ResourcesController) } | ||
|
||
it "should have resource_id set" do | ||
subject.should eq("resource") | ||
end | ||
end | ||
end |
33 changes: 33 additions & 0 deletions
33
spec/dummy/app/controllers/api/v2/nested/resources_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module Api | ||
module V2 | ||
class Nested::ResourcesController < V2::BaseController | ||
resource_description do | ||
name 'Resources' | ||
resource_id "resource" | ||
end | ||
api :GET, "/nested/resources/", "List all nested resources." | ||
def index | ||
end | ||
|
||
api :GET, "/nested/resources/:id/", "Show a nested resource." | ||
def show | ||
end | ||
|
||
api :POST, "/nested/resources/", "Create a nested resource." | ||
param_group :arch, Api::V1::ArchitecturesController | ||
def create | ||
end | ||
|
||
api :PUT, "/nested/resources/:id/", "Update a nested resource." | ||
param :architecture, Hash, :required => true do | ||
param :name, String | ||
end | ||
def update | ||
end | ||
|
||
api :DELETE, "/resources/:id/", "Delete a nested resource." | ||
def destroy | ||
end | ||
end | ||
end | ||
end |