This repository has been archived by the owner on Jan 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
201 additions
and
50 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
esp_sdk (2.6.0) | ||
esp_sdk (2.7.0) | ||
activeresource (~> 4.0.0) | ||
api-auth (~> 2.0.0) | ||
rack | ||
|
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
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
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,37 @@ | ||
module ESP | ||
class Role < ESP::Resource | ||
# Not Implemented. You cannot create or update a Role. | ||
# | ||
# @return [void] | ||
def save | ||
fail ESP::NotImplementedError | ||
end | ||
|
||
# Not Implemented. You cannot destroy a Role. | ||
# | ||
# @return [void] | ||
def destroy | ||
fail ESP::NotImplementedError | ||
end | ||
|
||
# Not Implemented. You cannot search for a Role. | ||
# | ||
# @return [void] | ||
def self.where(*) | ||
fail ESP::NotImplementedError | ||
end | ||
|
||
# @!method self.find(id) | ||
# Find a Region by id | ||
# | ||
# *call-seq* -> +super.find(id)+ | ||
# | ||
# @param id [Integer, Numeric, #to_i] Required ID of the region to retrieve. | ||
# @return [ESP::Region] | ||
|
||
# @!method self.all | ||
# Return a paginated list. | ||
# | ||
# @return [ActiveResource::PaginatedCollection<ESP::Region>] | ||
end | ||
end |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module ESP | ||
VERSION = '2.6.0'.freeze | ||
VERSION = '2.7.0'.freeze | ||
end |
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,24 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') | ||
|
||
module ESP::Integration | ||
class RoleTest < ESP::Integration::TestCase | ||
context ESP::Role do | ||
context 'live calls' do | ||
setup do | ||
@role = ESP::Role.last | ||
fail "Live DB does not have any roles. Add a role and run tests again." if @role.blank? | ||
end | ||
|
||
context '#CRUD' do | ||
should 'be able to read' do | ||
assert_not_nil @role | ||
|
||
role = ESP::Role.find(@role.id) | ||
|
||
assert_not_nil role | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
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
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,44 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') | ||
|
||
module ESP | ||
class RoleTest < ActiveSupport::TestCase | ||
context ESP::Role do | ||
context '#create' do | ||
should 'not be implemented' do | ||
assert_raises ESP::NotImplementedError do | ||
ESP::Role.create(name: 'test') | ||
end | ||
end | ||
end | ||
|
||
context '#update' do | ||
should 'not be implemented' do | ||
role = build(:role) | ||
assert_raises ESP::NotImplementedError do | ||
role.save | ||
end | ||
end | ||
end | ||
|
||
context '#destroy' do | ||
should 'not be implemented' do | ||
role = build(:role) | ||
assert_raises ESP::NotImplementedError do | ||
role.destroy | ||
end | ||
end | ||
end | ||
|
||
context '.find' do | ||
should 'call the show api and return a role if searching by id' do | ||
stub_role = stub_request(:get, %r{roles/5.json*}).to_return(body: json(:role)) | ||
|
||
role = ESP::Role.find(5) | ||
|
||
assert_requested(stub_role) | ||
assert_equal ESP::Role, role.class | ||
end | ||
end | ||
end | ||
end | ||
end |
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
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
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,9 @@ | ||
FactoryGirl.define do | ||
factory :role, class: 'ESP::Role' do | ||
skip_create | ||
|
||
sequence(:id) { |n| n } | ||
type "roles" | ||
name "customer" | ||
end | ||
end |