named-routes 0.2.2 → 0.2.3
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/VERSION +1 -1
- data/lib/named-routes/routes.rb +4 -0
- data/spec/named-routes/routes_spec.rb +11 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/named-routes/routes.rb
CHANGED
@@ -81,6 +81,10 @@ module NamedRoutes
|
|
81
81
|
uri.gsub(Regexp.new("^#{File.join("", prefix.to_s)}"), "/").gsub("//", "/")
|
82
82
|
end
|
83
83
|
|
84
|
+
def as_json(*args)
|
85
|
+
instance.as_json(*args)
|
86
|
+
end
|
87
|
+
|
84
88
|
def method_missing(method_name, *args, &block)
|
85
89
|
if instance.respond_to?(method_name)
|
86
90
|
instance.send(method_name, *args, &block)
|
@@ -143,9 +143,19 @@ module NamedRoutes
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
|
146
|
+
describe ".as_json" do
|
147
|
+
it "returns a hash of all of the route methods as keys and the definions as values for the instance" do
|
148
|
+
routes.as_json.should == {
|
149
|
+
"root" => "/",
|
150
|
+
"current_user_category_top_choices" => "/current-user/:category/top-choices",
|
151
|
+
"decision_stream" => "/decision-streams/:stream_id"
|
152
|
+
}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
146
156
|
describe "#as_json" do
|
147
157
|
it "returns a hash of all of the route methods as keys and the definions as values" do
|
148
|
-
routes.as_json.should == {
|
158
|
+
routes.instance.as_json.should == {
|
149
159
|
"root" => "/",
|
150
160
|
"current_user_category_top_choices" => "/current-user/:category/top-choices",
|
151
161
|
"decision_stream" => "/decision-streams/:stream_id"
|