playerconnect-wsdsl 0.3.1 → 0.3.2
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/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/wsdsl.rb +6 -3
- data/playerconnect-wsdsl.gemspec +2 -2
- data/spec/wsdsl_spec.rb +70 -0
- metadata +2 -2
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Jeweler::Tasks.new do |gem|
|
|
11
11
|
gem.description = %Q{A Ruby DSL describing Web Services without implementation details.}
|
12
12
|
gem.email = "sdod"
|
13
13
|
gem.authors = ["Team SDOD"]
|
14
|
-
gem.version = "0.3.
|
14
|
+
gem.version = "0.3.2"
|
15
15
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
16
16
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
17
17
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/wsdsl.rb
CHANGED
@@ -169,9 +169,12 @@ class WSDSL
|
|
169
169
|
# @api private
|
170
170
|
def controller_dispatch(app)
|
171
171
|
unless @controller
|
172
|
-
|
173
|
-
@controller = Object
|
174
|
-
|
172
|
+
begin
|
173
|
+
@controller = Object
|
174
|
+
@controller_name.split("::").each do |const|
|
175
|
+
@controller = @controller.const_get(const)
|
176
|
+
end
|
177
|
+
rescue NameError => e
|
175
178
|
raise "The #{@controller_name} class was not found"
|
176
179
|
end
|
177
180
|
end
|
data/playerconnect-wsdsl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{playerconnect-wsdsl}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Team SDOD}]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-10-15}
|
13
13
|
s.description = %q{A Ruby DSL describing Web Services without implementation details.}
|
14
14
|
s.email = %q{sdod}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/wsdsl_spec.rb
CHANGED
@@ -97,6 +97,76 @@ describe WSDSL do
|
|
97
97
|
service.action.should be == :foo
|
98
98
|
end
|
99
99
|
|
100
|
+
describe "#controller_dispatch" do
|
101
|
+
|
102
|
+
class ProjectsController
|
103
|
+
def initialize(app, service)
|
104
|
+
@app = app
|
105
|
+
@service = service.name
|
106
|
+
end
|
107
|
+
|
108
|
+
def send(action)
|
109
|
+
[@app, @service, action]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
module Projects
|
114
|
+
class TasksController < ProjectsController
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
module Projects
|
119
|
+
module Tasks
|
120
|
+
class ItemsController < ProjectsController
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
before :all do
|
126
|
+
@original_services = WSList.all.dup
|
127
|
+
WSList.all.clear
|
128
|
+
end
|
129
|
+
|
130
|
+
after :all do
|
131
|
+
WSList.all.replace @original_services
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should be able to dispatch controller" do
|
135
|
+
describe_service("projects.xml") { |s| }
|
136
|
+
service = WSList.all.find{|s| s.url == "projects.xml"}
|
137
|
+
service.controller_dispatch("application").
|
138
|
+
should == ["application", "projects", "list"]
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should be able to dispatch namespaced controller" do
|
142
|
+
describe_service("project/:project_id/tasks.xml") do |service|
|
143
|
+
service.controller_name = "Projects::TasksController"
|
144
|
+
service.action = "list"
|
145
|
+
end
|
146
|
+
|
147
|
+
describe_service("project/:project_id/task/:task_id/items.xml") do |service|
|
148
|
+
service.controller_name = "Projects::Tasks::ItemsController"
|
149
|
+
service.action = "list"
|
150
|
+
end
|
151
|
+
|
152
|
+
service = WSList.all.find{|s| s.url == "project/:project_id/tasks.xml"}
|
153
|
+
service.controller_dispatch("application").should == ["application", "project", "list"]
|
154
|
+
|
155
|
+
service = WSList.all.find{|s| s.url == "project/:project_id/task/:task_id/items.xml"}
|
156
|
+
service.controller_dispatch("application").should == ["application", "project", "list"]
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should raise exception when controller class is not found" do
|
160
|
+
describe_service("unknown.xml") do |service|
|
161
|
+
service.controller_name = "UnknownController"
|
162
|
+
service.action = "list"
|
163
|
+
end
|
164
|
+
service = WSList.all.find{|s| s.url == "unknown.xml"}
|
165
|
+
lambda { service.controller_dispatch("application") }.
|
166
|
+
should raise_error("The UnknownController class was not found")
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
100
170
|
describe WSDSL::Params do
|
101
171
|
|
102
172
|
before(:all) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playerconnect-wsdsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
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: 2011-
|
12
|
+
date: 2011-10-15 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby DSL describing Web Services without implementation details.
|
15
15
|
email: sdod
|