named-routes 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -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"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 2
9
- version: 0.2.2
8
+ - 3
9
+ version: 0.2.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Takita