mirage 3.0.0.alpha.6 → 3.0.0.alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +54 -0
- data/VERSION +1 -1
- data/lib/mirage/client/template.rb +9 -0
- data/lib/mirage/client/template/model.rb +21 -5
- data/lib/mirage/client/template/model/common_methods.rb +26 -0
- data/lib/mirage/client/template/model/instance_methods.rb +13 -17
- data/mirage.gemspec +4 -4
- data/spec/client/client_spec.rb +8 -6
- data/spec/client/template/model/common_methods_spec.rb +25 -0
- data/spec/client/template/model/instance_methods_spec.rb +13 -16
- data/spec/client/template/model_spec.rb +61 -12
- data/spec/client/template_spec.rb +10 -0
- data/test.rb +11 -42
- metadata +5 -5
- data/lib/mirage/client/template/model/class_methods.rb +0 -11
- data/spec/client/template/model/class_methods_spec.rb +0 -19
data/README.md
CHANGED
@@ -39,6 +39,60 @@ if there was a more appropriate template.
|
|
39
39
|
|
40
40
|
Litteral matchers are worth more in the scoring process than regex based ones for example.
|
41
41
|
#### What's new in the Client:
|
42
|
+
##### 1. Template Models
|
43
|
+
Perhaps the biggest addition to the client. Simply mixin Mirage::Template::Model in to a class, give it a method called body and there you have it... a class that can be used to put objects straight on to Mirage.
|
44
|
+
|
45
|
+
* All the methods you find on a standard response can then be used at the class level to set defaults.
|
46
|
+
|
47
|
+
* Add builder methods to your class using the builder_methods class method.
|
48
|
+
|
49
|
+
**Example Usage:** (See rdoc for full details)
|
50
|
+
|
51
|
+
class UserProfile
|
52
|
+
extend Mirage::Template::Model
|
53
|
+
|
54
|
+
endpoint '/users'
|
55
|
+
http_method :get
|
56
|
+
status 200
|
57
|
+
content_type 'application/json'
|
58
|
+
|
59
|
+
builder_methods :firstname, :lastname, :age
|
60
|
+
|
61
|
+
def body
|
62
|
+
{firstname: firstname, lastname: lastname, age: age}.to_json
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
Mirage::Client.new.put UserProfile.new.firstname('Joe').lastname('blogs')
|
68
|
+
|
69
|
+
##### Client interface
|
70
|
+
The client interface has been overhauled to make it more usable. It supports a couple of different ways of specifying a template
|
71
|
+
to let to specify templates in the style that best suites your code. The block in the examples is executed in the scope of the template
|
72
|
+
object itself so any method in it can be called. The template is also passed in to the block if you prefer to to call the methods
|
73
|
+
on a variable.
|
74
|
+
|
75
|
+
**Example Usage:** (See rdoc for full details)
|
76
|
+
|
77
|
+
mirage = Mirage::Client.new
|
78
|
+
mirage.put('/users') do
|
79
|
+
status 201
|
80
|
+
http_method :put
|
81
|
+
body 'response'
|
82
|
+
|
83
|
+
required_body_content << 'Abracadabra'
|
84
|
+
required_headers['Header'] = 'value'
|
85
|
+
|
86
|
+
delay 1.5
|
87
|
+
end
|
88
|
+
|
89
|
+
# Template Model classes can be customised in exactly the same way
|
90
|
+
|
91
|
+
mirage.put UserProfile.new do
|
92
|
+
status 404
|
93
|
+
required_parameters[:name] = /joe.*/
|
94
|
+
end
|
95
|
+
|
42
96
|
|
43
97
|
### 2.4.0
|
44
98
|
---------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.0.alpha.
|
1
|
+
3.0.0.alpha.7
|
@@ -12,6 +12,7 @@ module Mirage
|
|
12
12
|
|
13
13
|
include HTTParty
|
14
14
|
include Model::InstanceMethods
|
15
|
+
include Model::CommonMethods
|
15
16
|
|
16
17
|
class << self
|
17
18
|
alias_method :backedup_get, :get
|
@@ -41,5 +42,13 @@ module Mirage
|
|
41
42
|
template
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
def initialize *args
|
47
|
+
endpoint = args.first
|
48
|
+
|
49
|
+
raise ArgumentError, "You must specify a string endpoint as the first argument" unless endpoint && endpoint.is_a?(String)
|
50
|
+
super *args
|
51
|
+
|
52
|
+
end
|
44
53
|
end
|
45
54
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
1
|
require 'client/helpers/method_builder'
|
3
|
-
require 'client/template/model/
|
2
|
+
require 'client/template/model/common_methods'
|
4
3
|
require 'client/template/model/instance_methods'
|
5
4
|
|
6
5
|
module Mirage
|
@@ -9,14 +8,31 @@ module Mirage
|
|
9
8
|
|
10
9
|
class << self
|
11
10
|
def extended clazz
|
12
|
-
clazz.extend(
|
11
|
+
clazz.extend(CommonMethods)
|
12
|
+
clazz.extend(Helpers::MethodBuilder)
|
13
13
|
clazz.send(:include, HTTParty)
|
14
|
+
clazz.send(:include, CommonMethods)
|
14
15
|
clazz.send(:include, InstanceMethods)
|
15
16
|
|
17
|
+
|
16
18
|
mod = Module.new do
|
17
19
|
def initialize *args
|
18
|
-
|
19
|
-
|
20
|
+
|
21
|
+
super *args
|
22
|
+
[:content_type,
|
23
|
+
:http_method,
|
24
|
+
:default,
|
25
|
+
:status,
|
26
|
+
:delay,
|
27
|
+
:required_parameters,
|
28
|
+
:required_body_content,
|
29
|
+
:required_headers,
|
30
|
+
:headers,
|
31
|
+
:endpoint, :delay].each do |attribute|
|
32
|
+
eval("#{attribute} self.class.#{attribute} if self.class.#{attribute}")
|
33
|
+
end
|
34
|
+
|
35
|
+
|
20
36
|
end
|
21
37
|
end
|
22
38
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Mirage
|
2
|
+
|
3
|
+
class Template
|
4
|
+
module Model
|
5
|
+
module CommonMethods
|
6
|
+
extend Helpers::MethodBuilder
|
7
|
+
|
8
|
+
builder_methods :content_type,
|
9
|
+
:http_method,
|
10
|
+
:default,
|
11
|
+
:status,
|
12
|
+
:delay,
|
13
|
+
:required_parameters,
|
14
|
+
:required_body_content,
|
15
|
+
:required_headers,
|
16
|
+
:headers,
|
17
|
+
:endpoint,
|
18
|
+
:body
|
19
|
+
|
20
|
+
alias value body
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -3,11 +3,17 @@ module Mirage
|
|
3
3
|
module Model
|
4
4
|
module InstanceMethods
|
5
5
|
extend Helpers::MethodBuilder
|
6
|
+
include CommonMethods
|
6
7
|
|
7
|
-
def initialize
|
8
|
-
|
8
|
+
def initialize *args
|
9
|
+
if args.last.is_a?(Template::Configuration)
|
10
|
+
default_config = args.delete_at(-1)
|
11
|
+
else
|
12
|
+
default_config = Template::Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
@endpoint, @body = *args
|
9
16
|
@content_type = default_config.content_type
|
10
|
-
@value = response
|
11
17
|
@http_method = default_config.http_method
|
12
18
|
@status = default_config.status
|
13
19
|
@delay = default_config.delay
|
@@ -18,20 +24,10 @@ module Mirage
|
|
18
24
|
@default = default_config.default
|
19
25
|
end
|
20
26
|
|
21
|
-
builder_method :
|
22
|
-
:http_method,
|
23
|
-
:default,
|
24
|
-
:status,
|
25
|
-
:delay,
|
26
|
-
:required_parameters,
|
27
|
-
:required_body_content,
|
28
|
-
:required_headers,
|
29
|
-
:endpoint,
|
30
|
-
:id,
|
27
|
+
builder_method :id,
|
31
28
|
:url,
|
32
|
-
:requests_url
|
33
|
-
|
34
|
-
:value
|
29
|
+
:requests_url
|
30
|
+
|
35
31
|
|
36
32
|
def create
|
37
33
|
@id = self.class.put("#{@endpoint}", :body => self.to_json, :headers => {'content-type' => 'application/json'})['id']
|
@@ -47,7 +43,7 @@ module Mirage
|
|
47
43
|
def to_json
|
48
44
|
{
|
49
45
|
:response => {
|
50
|
-
:body => Base64.encode64(
|
46
|
+
:body => Base64.encode64(body),
|
51
47
|
:status => status,
|
52
48
|
:default => default,
|
53
49
|
:content_type => content_type,
|
data/mirage.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mirage"
|
8
|
-
s.version = "3.0.0.alpha.
|
8
|
+
s.version = "3.0.0.alpha.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Leon Davis"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-30"
|
13
13
|
s.description = "Mirage aids testing of your applications by hosting mock responses so that your applications do not have to talk to real endpoints. Its accessible via HTTP and has a RESTful interface."
|
14
14
|
s.executables = ["mirage"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
"lib/mirage/client/template.rb",
|
66
66
|
"lib/mirage/client/template/configuration.rb",
|
67
67
|
"lib/mirage/client/template/model.rb",
|
68
|
-
"lib/mirage/client/template/model/
|
68
|
+
"lib/mirage/client/template/model/common_methods.rb",
|
69
69
|
"lib/mirage/client/template/model/instance_methods.rb",
|
70
70
|
"lib/mirage/client/templates.rb",
|
71
71
|
"mirage.gemspec",
|
@@ -87,7 +87,7 @@ Gem::Specification.new do |s|
|
|
87
87
|
"spec/client/requests_spec.rb",
|
88
88
|
"spec/client/runner_spec.rb",
|
89
89
|
"spec/client/template/configuration_spec.rb",
|
90
|
-
"spec/client/template/model/
|
90
|
+
"spec/client/template/model/common_methods_spec.rb",
|
91
91
|
"spec/client/template/model/instance_methods_spec.rb",
|
92
92
|
"spec/client/template/model_spec.rb",
|
93
93
|
"spec/client/template_spec.rb",
|
data/spec/client/client_spec.rb
CHANGED
@@ -62,16 +62,18 @@ describe Mirage::Client do
|
|
62
62
|
mirage.templates(1).should == mock_template
|
63
63
|
end
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
describe 'put' do
|
66
|
+
it "should put a response on mirage by passing args on to template's put method " do
|
67
|
+
endpoint, value, block = 'greeting', 'hello', Proc.new{}
|
67
68
|
|
68
|
-
|
69
|
-
|
69
|
+
templates_mock = mock('templates')
|
70
|
+
Templates.should_receive(:new).and_return(templates_mock)
|
70
71
|
|
71
72
|
templates_mock.should_receive(:put).with(endpoint, value, &block)
|
72
73
|
|
73
|
-
|
74
|
-
|
74
|
+
mirage = Client.new
|
75
|
+
mirage.put endpoint, value, &block
|
76
|
+
end
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe 'CommonMethods' do
|
3
|
+
let!(:model) do
|
4
|
+
Class.new do
|
5
|
+
include Template::Model::CommonMethods
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
let!(:instance) do
|
10
|
+
model.new '', ''
|
11
|
+
end
|
12
|
+
it 'should provide methods for customising the model' do
|
13
|
+
instance.methods.should include(:content_type,
|
14
|
+
:http_method,
|
15
|
+
:default,
|
16
|
+
:status,
|
17
|
+
:delay,
|
18
|
+
:required_parameters,
|
19
|
+
:required_body_content,
|
20
|
+
:required_headers,
|
21
|
+
:endpoint,
|
22
|
+
:headers,
|
23
|
+
:body)
|
24
|
+
end
|
25
|
+
end
|
@@ -13,24 +13,15 @@ describe Template::Model::InstanceMethods do
|
|
13
13
|
model.new '', ''
|
14
14
|
end
|
15
15
|
|
16
|
-
it 'should provide methods for customising the model' do
|
17
|
-
instance.methods.should include(:content_type,
|
18
|
-
:http_method,
|
19
|
-
:default,
|
20
|
-
:status,
|
21
|
-
:delay,
|
22
|
-
:required_parameters,
|
23
|
-
:required_body_content,
|
24
|
-
:required_headers,
|
25
|
-
:endpoint,
|
26
|
-
:id,
|
27
|
-
:url,
|
28
|
-
:requests_url,
|
29
|
-
:headers,
|
30
|
-
:value)
|
31
|
-
end
|
32
16
|
|
33
17
|
context 'initialize' do
|
18
|
+
|
19
|
+
it 'requires an endpoint' do
|
20
|
+
endpoint = 'value'
|
21
|
+
instance = model.new endpoint
|
22
|
+
instance.endpoint.should == endpoint
|
23
|
+
end
|
24
|
+
|
34
25
|
it 'requires an endpoint and value to be provided' do
|
35
26
|
endpoint, value = 'endpoint', 'value'
|
36
27
|
instance = model.new endpoint, value
|
@@ -50,6 +41,12 @@ describe Template::Model::InstanceMethods do
|
|
50
41
|
instance.http_method.should == config.http_method
|
51
42
|
instance.status.should == config.status
|
52
43
|
instance.default.should == config.default
|
44
|
+
|
45
|
+
instance = model.new 'endpoint', config
|
46
|
+
instance.content_type.should == config.content_type
|
47
|
+
instance.http_method.should == config.http_method
|
48
|
+
instance.status.should == config.status
|
49
|
+
instance.default.should == config.default
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Template::Model do
|
4
|
-
let(:endpoint){'endpoint'}
|
4
|
+
let(:endpoint) { 'endpoint' }
|
5
5
|
let!(:test_class) do
|
6
6
|
Class.new do
|
7
7
|
extend Template::Model
|
@@ -14,9 +14,13 @@ describe Template::Model do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
context 'class' do
|
17
|
-
it 'should extend
|
18
|
-
test_class.is_a?(Template::Model::ClassMethods).should == true
|
17
|
+
it 'should extend MethodBuilder and CommonMethods' do
|
19
18
|
test_class.is_a?(Helpers::MethodBuilder).should == true
|
19
|
+
test_class.is_a?(Template::Model::CommonMethods).should == true
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should include Instance methods' do
|
23
|
+
test_class.is_a?(Template::Model::CommonMethods).should == true
|
20
24
|
end
|
21
25
|
|
22
26
|
context 'inherited constructor' do
|
@@ -47,24 +51,69 @@ describe Template::Model do
|
|
47
51
|
test_class.ancestors.should include(HTTParty)
|
48
52
|
end
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
describe 'defaults' do
|
55
|
+
|
56
|
+
it 'should be default the endpoint' do
|
57
|
+
endpoint = 'endpoint'
|
58
|
+
test_class.endpoint endpoint
|
59
|
+
test_class.new.endpoint.should == endpoint
|
60
|
+
end
|
55
61
|
|
56
|
-
|
57
|
-
it 'sets the status of instances if set' do
|
62
|
+
it 'should be default the status' do
|
58
63
|
status = 404
|
59
64
|
test_class.status status
|
60
65
|
test_class.new.status.should == status
|
61
66
|
end
|
62
67
|
|
63
|
-
it '
|
64
|
-
|
68
|
+
it 'should be default the content-type' do
|
69
|
+
content_type = 'application/json'
|
70
|
+
test_class.content_type content_type
|
71
|
+
test_class.new.content_type.should == content_type
|
65
72
|
end
|
66
73
|
|
74
|
+
it 'should be default the http_method' do
|
75
|
+
method = :post
|
76
|
+
test_class.http_method method
|
77
|
+
test_class.new.http_method.should == method
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should be default the default status' do
|
81
|
+
default = true
|
82
|
+
test_class.default default
|
83
|
+
test_class.new.default.should == default
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should be default the required parameters' do
|
87
|
+
required_parameters = {name: 'joe'}
|
88
|
+
test_class.required_parameters required_parameters
|
89
|
+
test_class.new.required_parameters.should == required_parameters
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should be default the required headers' do
|
93
|
+
headers = {name: 'joe'}
|
94
|
+
test_class.required_headers headers
|
95
|
+
test_class.new.required_headers.should == headers
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should be default the required body content' do
|
99
|
+
content = ['content']
|
100
|
+
test_class.required_body_content content
|
101
|
+
test_class.new.required_body_content.should == content
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should be default the headers' do
|
105
|
+
headers = {name: 'joe'}
|
106
|
+
test_class.headers headers
|
107
|
+
test_class.new.headers.should == headers
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'should be default the delay' do
|
111
|
+
delay = 4
|
112
|
+
test_class.delay delay
|
113
|
+
test_class.new.delay.should == delay
|
114
|
+
end
|
67
115
|
end
|
116
|
+
|
68
117
|
end
|
69
118
|
|
70
119
|
end
|
@@ -66,6 +66,16 @@ describe Mirage::Template do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
describe 'initialize' do
|
70
|
+
it 'throws and exception if an endpoint is not supplied as the first parameter' do
|
71
|
+
expect{Template.new}.to raise_error(ArgumentError)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'throws and exception if first argument is not a string' do
|
75
|
+
expect{Template.new(:endpoint)}.to raise_error(ArgumentError)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
69
79
|
|
70
80
|
describe 'creating' do
|
71
81
|
json = "reponse json"
|
data/test.rb
CHANGED
@@ -1,50 +1,19 @@
|
|
1
1
|
require './lib/mirage/client'
|
2
|
-
|
3
|
-
#class ServiceNowResponse
|
4
|
-
# extend Mirage::Template::Model
|
5
|
-
#
|
6
|
-
# endpoint 'service_now'
|
7
|
-
#
|
8
|
-
# builder_methods :this,:that
|
9
|
-
#
|
10
|
-
# def value
|
11
|
-
# "my value : #{this}, #{that}"
|
12
|
-
# end
|
13
|
-
#end
|
14
|
-
#
|
15
|
-
Mirage.stop
|
16
|
-
mirage = Mirage.start
|
17
|
-
#mirage.put ServiceNowResponse.new.this('foo').that('bar')
|
18
|
-
#mirage.put ServiceNowResponse.new.this('foo').that('bar').required_body_content(%w(hello world))
|
19
|
-
#mirage.put ServiceNowResponse.new.this('foo').that('bar').required_parameters({:name => 'leon'})
|
20
|
-
|
21
|
-
require 'ostruct'
|
22
|
-
class UserServiceProfile
|
2
|
+
class UserProfile
|
23
3
|
extend Mirage::Template::Model
|
24
4
|
|
25
|
-
endpoint '
|
5
|
+
endpoint '/users'
|
6
|
+
http_method :get
|
7
|
+
status 200
|
8
|
+
content_type 'application/json'
|
9
|
+
required_body_content %w(leon davis)
|
26
10
|
|
27
|
-
|
28
|
-
super
|
29
|
-
required_parameters[:token] = persona.token
|
30
|
-
@persona = persona
|
31
|
-
end
|
11
|
+
builder_methods :firstname, :lastname, :age
|
32
12
|
|
33
|
-
def
|
34
|
-
{
|
13
|
+
def body
|
14
|
+
{firstname: firstname, lastname: lastname, age: age}.to_json
|
35
15
|
end
|
36
16
|
end
|
37
17
|
|
38
|
-
|
39
|
-
|
40
|
-
:token => '1234'
|
41
|
-
)
|
42
|
-
|
43
|
-
mirage.clear
|
44
|
-
|
45
|
-
|
46
|
-
leons_user_profile = UserServiceProfile.new leon
|
47
|
-
mirage.put leons_user_profile do
|
48
|
-
status 404
|
49
|
-
method :get
|
50
|
-
end
|
18
|
+
mirage = Mirage.start
|
19
|
+
mirage.put UserProfile.new.firstname('leon').lastname('davis').age(30)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mirage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.alpha.
|
4
|
+
version: 3.0.0.alpha.7
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -294,7 +294,7 @@ files:
|
|
294
294
|
- lib/mirage/client/template.rb
|
295
295
|
- lib/mirage/client/template/configuration.rb
|
296
296
|
- lib/mirage/client/template/model.rb
|
297
|
-
- lib/mirage/client/template/model/
|
297
|
+
- lib/mirage/client/template/model/common_methods.rb
|
298
298
|
- lib/mirage/client/template/model/instance_methods.rb
|
299
299
|
- lib/mirage/client/templates.rb
|
300
300
|
- mirage.gemspec
|
@@ -316,7 +316,7 @@ files:
|
|
316
316
|
- spec/client/requests_spec.rb
|
317
317
|
- spec/client/runner_spec.rb
|
318
318
|
- spec/client/template/configuration_spec.rb
|
319
|
-
- spec/client/template/model/
|
319
|
+
- spec/client/template/model/common_methods_spec.rb
|
320
320
|
- spec/client/template/model/instance_methods_spec.rb
|
321
321
|
- spec/client/template/model_spec.rb
|
322
322
|
- spec/client/template_spec.rb
|
@@ -349,7 +349,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
349
349
|
version: '0'
|
350
350
|
segments:
|
351
351
|
- 0
|
352
|
-
hash:
|
352
|
+
hash: 817642380514883205
|
353
353
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
354
354
|
none: false
|
355
355
|
requirements:
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Template::Model::ClassMethods do
|
4
|
-
context 'class methods' do
|
5
|
-
|
6
|
-
it 'should provide a method for setting the endpoint for the class' do
|
7
|
-
endpoint = 'endpoint'
|
8
|
-
model_class = Class.new do
|
9
|
-
extend Template::Model::ClassMethods
|
10
|
-
|
11
|
-
endpoint endpoint
|
12
|
-
end
|
13
|
-
|
14
|
-
model_class.endpoint.should == endpoint
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|