eastwood 0.3.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ test/dummy/db/*.sqlite3
5
5
  test/dummy/log/*.log
6
6
  test/dummy/tmp/
7
7
  spec/rails/rails-*
8
+ coverage/
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ gemfiles:
5
+ - gemfiles/rails-3.1.0.gemfile
6
+ - gemfiles/rails-3.2.0.gemfile
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eastwood (0.3.2)
4
+ eastwood (0.3.4)
5
5
  coffee-rails
6
6
  rails
7
7
 
@@ -101,6 +101,10 @@ GEM
101
101
  railties (>= 3.0)
102
102
  rspec (~> 2.8.0)
103
103
  shoulda (2.11.3)
104
+ simplecov (0.6.1)
105
+ multi_json (~> 1.0)
106
+ simplecov-html (~> 0.5.3)
107
+ simplecov-html (0.5.3)
104
108
  sprockets (2.1.2)
105
109
  hike (~> 1.2)
106
110
  rack (~> 1.0)
@@ -122,4 +126,5 @@ DEPENDENCIES
122
126
  execjs (= 1.3.0)
123
127
  rspec-rails (= 2.8.1)
124
128
  shoulda
129
+ simplecov (= 0.6.1)
125
130
  sqlite3
data/README.md CHANGED
@@ -1,6 +1,134 @@
1
1
  Eastwood
2
2
  ========
3
3
 
4
- Eastwood is still under development. Hit that watch button, yo.
4
+ > Start your client side out right.
5
5
 
6
- This project rocks and uses MIT-LICENSE.
6
+ [![Build Status](https://secure.travis-ci.org/jeremyruppel/eastwood.png)](http://travis-ci.org/jeremyruppel/eastwood)
7
+
8
+ About
9
+ -----
10
+
11
+ Eastwood brings your Rails routes to the client side in a slick, unobtrusive way.
12
+
13
+ As of v0.3.2, Eastwood supports Rails >= 3.1.0, which means both `ActionDispatch`
14
+ and `Journey` routers are supported.
15
+
16
+ Usage
17
+ -----
18
+
19
+ Include eastwood in your gemfile:
20
+
21
+ gem 'eastwood'
22
+
23
+ Then mount the engine wherever you want:
24
+
25
+ mount Eastwood::Engine => '/eastwood
26
+
27
+ > The place you mount the engine actually doesn't make much of a difference right now.
28
+ > The engine itself has no routes, just a single javascript asset you can include
29
+ > through the pipeline.
30
+
31
+ Finally, require `eastwood.js` in your javascript manifest.
32
+
33
+ #= require eastwood
34
+
35
+ Routes
36
+ ------
37
+
38
+ Eastwood will give you a namespace for your application, as well as all of your named
39
+ route helpers converted to javascript functions. If your app is named **MyApp**, requiring
40
+ the Eastwood javascript will give you something like this available on `window`:
41
+
42
+ MyApp : {
43
+ env : 'development',
44
+ routes : {
45
+ new_user_path : function( format ){
46
+ // javascript to return you a string route, with segment keys
47
+ // interpolated, and including either the format you specify
48
+ // or the default 'json'.
49
+ }
50
+ }
51
+ }
52
+
53
+ > This namespace is also a great place to put the rest of your client-side code!
54
+
55
+ Configuration
56
+ -------------
57
+
58
+ Create a `config/initializers/eastwood.rb` and you can do the following:
59
+
60
+ Eastwood.configure do |config|
61
+ config.default_route_format = :json # or :xml, 'html', etc to change it, or false or '' to leave it blank
62
+ end
63
+
64
+ Hashes
65
+ ------
66
+
67
+ Eastwood can include arbitrary "routes" for the client-side too. In your configure block:
68
+
69
+ Eastwood.configure do |config|
70
+ config.hash :foo, '#/foo'
71
+ config.hash :bar, '/bar/:id'
72
+ end
73
+
74
+ This will give you `foo_hash` and `bar_hash` as functions in `MyApp.routes`, with all segments
75
+ interpolated as you would expect.
76
+
77
+ Exports
78
+ -------
79
+
80
+ Eastwood can also export arbitrary values to the client side:
81
+
82
+ Eastwood.configure do |config|
83
+ config.export :foo => 'bar', :baz => 123.45
84
+ end
85
+
86
+ Pro Tips
87
+ --------
88
+
89
+ Eastwood plays *really* well with [Sammy.js](http://sammyjs.org/):
90
+
91
+ # include all of our eastwood routes as sammy helpers
92
+ @helpers MyApp.routes
93
+
94
+ # ...
95
+
96
+ # use our eastwood routes in the event context
97
+ @render @clients_path( 'wal' ), result, -> $( '#clients' ).html @content
98
+
99
+ Eastwood also plays really well with client-side templating solutions that treat
100
+ functions like first-class citizens like, *ahem*, [walrus](https://github.com/jeremyruppel/walrus):
101
+
102
+ <li>
103
+ <a href="{{@clients_path( 'html' )}}">Clients</a>
104
+ </li>
105
+
106
+ Reloading
107
+ ---------
108
+
109
+ Since Sprockets [doesn't know when your context helpers change](https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/base.rb#L35), you may
110
+ need to clear out your sprockets cache when you change your routes. Just run `rake tmp:clear`.
111
+
112
+ License
113
+ -------
114
+
115
+ > Copyright 2012 Jeremy Ruppel
116
+ >
117
+ > Permission is hereby granted, free of charge, to any person obtaining
118
+ > a copy of this software and associated documentation files (the
119
+ > "Software"), to deal in the Software without restriction, including
120
+ > without limitation the rights to use, copy, modify, merge, publish,
121
+ > distribute, sublicense, and/or sell copies of the Software, and to
122
+ > permit persons to whom the Software is furnished to do so, subject to
123
+ > the following conditions:
124
+ >
125
+ > The above copyright notice and this permission notice shall be
126
+ > included in all copies or substantial portions of the Software.
127
+ >
128
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
129
+ > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
130
+ > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
131
+ > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
132
+ > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
133
+ > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
134
+ > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -32,3 +32,11 @@ namespace :eastwood do
32
32
  end
33
33
 
34
34
  RSpec::Core::RakeTask.new :spec => [ :'eastwood:env', :'eastwood:rails' ]
35
+
36
+ desc "Run specs for all supported rails versions"
37
+ task :all do
38
+ exec 'rake appraisal spec'
39
+ end
40
+
41
+ desc "Default: Clean, install dependencies, and run specs"
42
+ task :default => [ :'eastwood:clean', :'appraisal:install', :all ]
@@ -4,19 +4,22 @@
4
4
  app = { env : "<%= env %>", routes : { } }
5
5
 
6
6
  ###*
7
- * Routes
7
+ * Exports
8
8
  ###
9
- <% routes.each do |key, route| %>
10
- app.routes.<%= route.coffee_name %> = ( <%= route.coffee_args %> ) ->
11
- "<%= route.coffee_path %>"
9
+ app.exports =
10
+ <% exports.each do |key, value| %>
11
+ <%= key.to_s %> : <%= value.is_a?( String ) ? "'#{value}'" : value %>
12
12
  <% end %>
13
13
 
14
14
  ###*
15
- * Hashes
15
+ * Routes
16
16
  ###
17
+ app.routes =
18
+ <% routes.each do |key, route| %>
19
+ <%= route.coffee_name %> : ( <%= route.coffee_args %> ) -> "<%= route.coffee_path %>"
20
+ <% end %>
17
21
  <% hashes.each do |key, route| %>
18
- app.routes.<%= route.coffee_name %> = ( <%= route.coffee_args %> ) ->
19
- "<%= route.coffee_path %>"
22
+ <%= route.coffee_name %> : ( <%= route.coffee_args %> ) -> "<%= route.coffee_path %>"
20
23
  <% end %>
21
24
 
22
25
  ###*
data/eastwood.gemspec CHANGED
@@ -30,4 +30,5 @@ Gem::Specification.new do |s|
30
30
  s.add_development_dependency 'rspec-rails', '2.8.1'
31
31
  s.add_development_dependency 'shoulda'
32
32
  s.add_development_dependency 'execjs', '1.3.0'
33
+ s.add_development_dependency 'simplecov', '0.6.1'
33
34
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/jeremyruppel/Git/eastwood
2
+ remote: /Users/jeremy.ruppel/Git/eastwood
3
3
  specs:
4
- eastwood (0.3.2)
4
+ eastwood (0.3.5)
5
5
  coffee-rails
6
6
  rails
7
7
 
@@ -109,6 +109,10 @@ GEM
109
109
  shoulda-matchers (~> 1.0.0)
110
110
  shoulda-context (1.0.0)
111
111
  shoulda-matchers (1.0.0)
112
+ simplecov (0.6.1)
113
+ multi_json (~> 1.0)
114
+ simplecov-html (~> 0.5.3)
115
+ simplecov-html (0.5.3)
112
116
  sprockets (2.0.3)
113
117
  hike (~> 1.2)
114
118
  rack (~> 1.0)
@@ -131,4 +135,5 @@ DEPENDENCIES
131
135
  rails (= 3.1.0)
132
136
  rspec-rails (= 2.8.1)
133
137
  shoulda
138
+ simplecov (= 0.6.1)
134
139
  sqlite3
@@ -1,7 +1,7 @@
1
1
  PATH
2
- remote: /Users/jeremyruppel/Git/eastwood
2
+ remote: /Users/jeremy.ruppel/Git/eastwood
3
3
  specs:
4
- eastwood (0.3.2)
4
+ eastwood (0.3.5)
5
5
  coffee-rails
6
6
  rails
7
7
 
@@ -101,6 +101,10 @@ GEM
101
101
  railties (>= 3.0)
102
102
  rspec (~> 2.8.0)
103
103
  shoulda (2.11.3)
104
+ simplecov (0.6.1)
105
+ multi_json (~> 1.0)
106
+ simplecov-html (~> 0.5.3)
107
+ simplecov-html (0.5.3)
104
108
  sprockets (2.1.2)
105
109
  hike (~> 1.2)
106
110
  rack (~> 1.0)
@@ -123,4 +127,5 @@ DEPENDENCIES
123
127
  rails (= 3.2.0)
124
128
  rspec-rails (= 2.8.1)
125
129
  shoulda
130
+ simplecov (= 0.6.1)
126
131
  sqlite3
@@ -16,6 +16,14 @@ module Eastwood
16
16
  @@hashes ||= Hash.new
17
17
  end
18
18
 
19
+ def export( *args )
20
+ exports.merge! *args
21
+ end
22
+
23
+ def exports
24
+ @@exports ||= Hash.new
25
+ end
26
+
19
27
  mattr_accessor :default_route_format
20
28
 
21
29
  def reset!
@@ -0,0 +1,30 @@
1
+ module Eastwood
2
+ module Context
3
+ class ActionRoute < Struct.new( :route, :format )
4
+
5
+ def name
6
+ route.name
7
+ end
8
+
9
+ def parts
10
+ route.segment_keys
11
+ end
12
+
13
+ def path
14
+ route.path.delete '()'
15
+ end
16
+
17
+ def coffee_name
18
+ "#{name}_path"
19
+ end
20
+
21
+ def coffee_args
22
+ parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
23
+ end
24
+
25
+ def coffee_path
26
+ path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module Eastwood
2
+ module Context
3
+ class HashRoute < Struct.new( :key, :hash )
4
+
5
+ def name
6
+ key.to_s
7
+ end
8
+
9
+ def parts
10
+ hash.scan( /:(\w+)/ ).flatten.map &:to_sym
11
+ end
12
+
13
+ def path
14
+ hash
15
+ end
16
+
17
+ def coffee_name
18
+ "#{name}_hash"
19
+ end
20
+
21
+ def coffee_args
22
+ parts.join ', '
23
+ end
24
+
25
+ def coffee_path
26
+ path.gsub /:(\w+)/, '#{\1}'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module Eastwood
2
+ module Context
3
+ class JourneyRoute < Struct.new( :route, :format )
4
+
5
+ def name
6
+ route.name
7
+ end
8
+
9
+ def parts
10
+ route.parts
11
+ end
12
+
13
+ def path
14
+ route.path.spec.to_s.delete '()'
15
+ end
16
+
17
+ def coffee_name
18
+ "#{name}_path"
19
+ end
20
+
21
+ def coffee_args
22
+ parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
23
+ end
24
+
25
+ def coffee_path
26
+ path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,69 +1,6 @@
1
1
  module Eastwood
2
2
  module Context
3
3
 
4
- class ActionRoute < Struct.new( :route, :format )
5
- def name
6
- route.name
7
- end
8
- def parts
9
- route.segment_keys
10
- end
11
- def path
12
- route.path.delete '()'
13
- end
14
- def coffee_name
15
- "#{name}_path"
16
- end
17
- def coffee_args
18
- parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
19
- end
20
- def coffee_path
21
- path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
22
- end
23
- end
24
-
25
- class JourneyRoute < Struct.new( :route, :format )
26
- def name
27
- route.name
28
- end
29
- def parts
30
- route.parts
31
- end
32
- def path
33
- route.path.spec.to_s.delete '()'
34
- end
35
- def coffee_name
36
- "#{name}_path"
37
- end
38
- def coffee_args
39
- parts.any? ? "#{parts.join( ', ' )}='#{format}'" : ''
40
- end
41
- def coffee_path
42
- path.delete( '.' ).gsub /:(\w+)/, '#{\1}'
43
- end
44
- end
45
-
46
- class HashRoute < Struct.new( :key, :hash )
47
- def name
48
- key.to_s
49
- end
50
- def parts
51
- hash.scan( /:(\w+)/ ).flatten.map &:to_sym
52
- end
53
- def path
54
- hash
55
- end
56
- def coffee_name
57
- "#{name}_hash"
58
- end
59
- def coffee_args
60
- parts.join ', '
61
- end
62
- def coffee_path
63
- path.gsub /:(\w+)/, '#{\1}'
64
- end
65
- end
66
-
67
4
  def app
68
5
  Eastwood.application_name
69
6
  end
@@ -90,6 +27,10 @@ module Eastwood
90
27
  named_hashes.merge( named_hashes ){ |key, hash| HashRoute.new key, hash }
91
28
  end
92
29
 
30
+ def exports
31
+ Eastwood.exports
32
+ end
33
+
93
34
  def route_format
94
35
  omit_route_format? ? '' : ".#{Eastwood.default_route_format.to_s}"
95
36
  end
@@ -6,10 +6,6 @@ module Eastwood
6
6
  app.assets.context_class.instance_eval do
7
7
  include Eastwood::Context
8
8
  end
9
- # watch for changes in eastwood initializer
10
- if app.config.respond_to? :watchable_files
11
- app.config.watchable_files << 'config/initializers/eastwood.rb'
12
- end
13
9
  end
14
10
  end
15
11
  end
@@ -5,6 +5,7 @@ module Eastwood
5
5
  module ClassMethods
6
6
 
7
7
  def application_name
8
+ # TODO store
8
9
  ::Rails.application.class.name.split( '::' ).first
9
10
  end
10
11
 
@@ -1,3 +1,3 @@
1
1
  module Eastwood
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.5"
3
3
  end
data/lib/eastwood.rb CHANGED
@@ -4,6 +4,12 @@ module Eastwood
4
4
  autoload :Engine, 'eastwood/engine'
5
5
  autoload :Rails, 'eastwood/rails'
6
6
 
7
+ module Context
8
+ autoload :ActionRoute, 'eastwood/context/action_route'
9
+ autoload :JourneyRoute, 'eastwood/context/journey_route'
10
+ autoload :HashRoute, 'eastwood/context/hash_route'
11
+ end
12
+
7
13
  class << self
8
14
 
9
15
  def configure
@@ -6,8 +6,10 @@ describe 'eastwood.js' do
6
6
  get '/assets/eastwood.js'
7
7
  end
8
8
 
9
- let( :context ){ ExecJS.compile response.body }
10
- let( :routes ){ "window.#{Eastwood.application_name}.routes" }
9
+ let( :context ){ ExecJS.compile response.body }
10
+ let( :namespace ){ "window.#{Eastwood.application_name}" }
11
+ let( :routes ){ "#{namespace}.routes" }
12
+ let( :exports ){ "#{namespace}.exports" }
11
13
 
12
14
  describe 'the response' do
13
15
  subject { response }
@@ -75,4 +77,19 @@ describe 'eastwood.js' do
75
77
  context.call( "#{routes}.post_hash", 'foo', 'bar' ).should eq( '#/users/foo/posts/bar' )
76
78
  end
77
79
  end
80
+
81
+ describe 'exports' do
82
+ it 'should be defined' do
83
+ context.eval( "typeof #{exports}" ).should eq( 'object' )
84
+ end
85
+ it 'should export strings properly' do
86
+ context.eval( "#{exports}.string" ).should eq( 'foo' )
87
+ end
88
+ it 'should export floats properly' do
89
+ context.eval( "#{exports}.float" ).should eq( 123.45 )
90
+ end
91
+ it 'should export booleans properly' do
92
+ context.eval( "#{exports}.boolean" ).should eq( true )
93
+ end
94
+ end
78
95
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # Start simplecov instrumentation
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+
1
5
  # Set the environment variables for the test app
2
6
  ENV[ 'RAILS_ENV' ] = 'test'
3
7
  # ENV[ 'RAILS_ROOT' ] =
@@ -36,3 +40,19 @@ RSpec.configure do |config|
36
40
  Eastwood.reset!
37
41
  end
38
42
  end
43
+
44
+ RSpec::Matchers.define :delegate do |method|
45
+ match do |delegate|
46
+ delegate.send method
47
+ end
48
+ chain :to do |receiver, method|
49
+ @receiver, @method = receiver, method
50
+ @receiver.should_receive( @method ){ true }
51
+ end
52
+ description do
53
+ "delegate ##{method} to #{@receiver}##{@method}"
54
+ end
55
+ failure_message_for_should do |delegate|
56
+ "expected that #{delegate}##{method} would delegate to #{@receiver}##{@method}"
57
+ end
58
+ end
@@ -20,5 +20,9 @@ Eastwood.configure do |config|
20
20
  config.hash :home, '#/home'
21
21
  config.hash :user, '#/users/:id'
22
22
  config.hash :post, '#/users/:id/posts/:slug'
23
+
24
+ config.export :string => 'foo',
25
+ :float => 123.45,
26
+ :boolean => true
23
27
  end
24
28
  CODE
@@ -38,6 +38,31 @@ describe Eastwood do
38
38
  end
39
39
  end
40
40
 
41
+ describe '#export' do
42
+ it { should respond_to( :export ) }
43
+
44
+ describe 'adding exports' do
45
+ before do
46
+ Eastwood.export :foo => 'bar', :baz => 'qux'
47
+ end
48
+
49
+ subject { Eastwood.exports }
50
+
51
+ it { should include( :foo => 'bar', :baz => 'qux' ) }
52
+ end
53
+
54
+ describe 'overwriting an export' do
55
+ before do
56
+ Eastwood.export :foo => 'bar'
57
+ Eastwood.export :foo => 'baz'
58
+ end
59
+
60
+ subject { Eastwood.exports }
61
+
62
+ it { should include( :foo => 'baz' ) }
63
+ end
64
+ end
65
+
41
66
  describe '#default_route_format' do
42
67
  it { should respond_to( :default_route_format ) }
43
68
 
@@ -9,20 +9,12 @@ describe 'the Sprockets context class' do
9
9
 
10
10
  describe '#app' do
11
11
  it { should respond_to( :app ) }
12
-
13
- it 'should delegate to Eastwood.application_name' do
14
- Eastwood.should_receive :application_name
15
- subject.app
16
- end
12
+ it { should delegate( :app ).to( Eastwood, :application_name ) }
17
13
  end
18
14
 
19
15
  describe '#env' do
20
16
  it { should respond_to( :env ) }
21
-
22
- it 'should delegate to Eastwood.env' do
23
- Eastwood.should_receive :env
24
- subject.env
25
- end
17
+ it { should delegate( :env ).to( Eastwood, :env ) }
26
18
  end
27
19
 
28
20
  describe '#routes' do
@@ -35,6 +27,11 @@ describe 'the Sprockets context class' do
35
27
  its( :hashes ){ should be_a( Hash ) }
36
28
  end
37
29
 
30
+ describe '#exports' do
31
+ it { should respond_to( :exports ) }
32
+ it { should delegate( :exports ).to( Eastwood, :exports ) }
33
+ end
34
+
38
35
  describe '#target' do
39
36
  it { should respond_to( :target ) }
40
37
 
@@ -9,19 +9,11 @@ describe Eastwood do
9
9
 
10
10
  describe '#env' do
11
11
  it { should respond_to( :env ) }
12
-
13
- it 'should delegate to the rails env' do
14
- ::Rails.should_receive :env
15
- Eastwood.env
16
- end
12
+ it { should delegate( :env ).to( ::Rails, :env ) }
17
13
  end
18
14
 
19
15
  describe '#named_routes' do
20
16
  it { should respond_to( :named_routes ) }
21
-
22
- it 'should delegate to the rails named routes' do
23
- ::Rails.application.routes.named_routes.should_receive :routes
24
- Eastwood.named_routes
25
- end
17
+ it { should delegate( :named_routes ).to( ::Rails.application.routes.named_routes, :routes ) }
26
18
  end
27
19
  end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ shared_examples 'a route adapter' do
4
+ subject { described_class.new( route, 'json' ) }
5
+
6
+ it { should respond_to( :name ) }
7
+ it { should respond_to( :parts ) }
8
+ it { should respond_to( :path ) }
9
+ it { should respond_to( :coffee_name ) }
10
+ it { should respond_to( :coffee_args ) }
11
+ it { should respond_to( :coffee_path ) }
12
+
13
+ its( :name ){ should eq( 'foo' ) }
14
+ its( :parts ){ should eq( [ :bar, :baz, :format ] ) }
15
+ its( :path ){ should eq( '/foo/:bar/:baz.:format' ) }
16
+ its( :coffee_name ){ should eq( 'foo_path' ) }
17
+ its( :coffee_args ){ should eq( "bar, baz, format='json'" ) }
18
+ its( :coffee_path ){ should eq( '/foo/#{bar}/#{baz}#{format}' ) }
19
+ end
20
+
21
+ describe Eastwood::Context::ActionRoute do
22
+ it_behaves_like 'a route adapter' do
23
+ let( :route ){ double 'route' } # ActionDispatch::Routing::Route
24
+ before do
25
+ route.stub( :name ){ 'foo' }
26
+ route.stub( :segment_keys ){ [ :bar, :baz, :format ] }
27
+ route.stub( :path ){ '/foo/:bar/:baz(.:format)' }
28
+ end
29
+ end
30
+ end
31
+
32
+ describe Eastwood::Context::JourneyRoute do
33
+ it_behaves_like 'a route adapter' do
34
+ let( :route ){ double 'route' } # Journey::Route
35
+ before do
36
+ route.stub( :name ){ 'foo' }
37
+ route.stub( :parts ){ [ :bar, :baz, :format ] }
38
+ route.stub_chain( :path, :spec, :to_s => '/foo/:bar/:baz(.:format)' )
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eastwood
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-27 00:00:00.000000000 Z
12
+ date: 2012-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &97190 !ruby/object:Gem::Requirement
16
+ requirement: &2156421000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *97190
24
+ version_requirements: *2156421000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: coffee-rails
27
- requirement: &96550 !ruby/object:Gem::Requirement
27
+ requirement: &2156420440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *96550
35
+ version_requirements: *2156420440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &95890 !ruby/object:Gem::Requirement
38
+ requirement: &2156434460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *95890
46
+ version_requirements: *2156434460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: appraisal
49
- requirement: &94610 !ruby/object:Gem::Requirement
49
+ requirement: &2156431260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - =
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.4.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *94610
57
+ version_requirements: *2156431260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec-rails
60
- requirement: &93320 !ruby/object:Gem::Requirement
60
+ requirement: &2156429120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - =
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.8.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *93320
68
+ version_requirements: *2156429120
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: shoulda
71
- requirement: &92860 !ruby/object:Gem::Requirement
71
+ requirement: &2156428500 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *92860
79
+ version_requirements: *2156428500
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: execjs
82
- requirement: &92110 !ruby/object:Gem::Requirement
82
+ requirement: &2156441340 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - =
@@ -87,7 +87,18 @@ dependencies:
87
87
  version: 1.3.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *92110
90
+ version_requirements: *2156441340
91
+ - !ruby/object:Gem::Dependency
92
+ name: simplecov
93
+ requirement: &2156437080 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - =
97
+ - !ruby/object:Gem::Version
98
+ version: 0.6.1
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2156437080
91
102
  description: Start your client side out right
92
103
  email:
93
104
  - jeremy.ruppel@gmail.com
@@ -97,6 +108,7 @@ extra_rdoc_files: []
97
108
  files:
98
109
  - .gitignore
99
110
  - .rvmrc
111
+ - .travis.yml
100
112
  - Appraisals
101
113
  - Gemfile
102
114
  - Gemfile.lock
@@ -112,6 +124,9 @@ files:
112
124
  - lib/eastwood.rb
113
125
  - lib/eastwood/config.rb
114
126
  - lib/eastwood/context.rb
127
+ - lib/eastwood/context/action_route.rb
128
+ - lib/eastwood/context/hash_route.rb
129
+ - lib/eastwood/context/journey_route.rb
115
130
  - lib/eastwood/engine.rb
116
131
  - lib/eastwood/rails.rb
117
132
  - lib/eastwood/version.rb
@@ -123,6 +138,7 @@ files:
123
138
  - spec/unit/context_spec.rb
124
139
  - spec/unit/format_spec.rb
125
140
  - spec/unit/rails_spec.rb
141
+ - spec/unit/route_spec.rb
126
142
  homepage: https://github.com/jeremyruppel/eastwood
127
143
  licenses: []
128
144
  post_install_message:
@@ -156,3 +172,4 @@ test_files:
156
172
  - spec/unit/context_spec.rb
157
173
  - spec/unit/format_spec.rb
158
174
  - spec/unit/rails_spec.rb
175
+ - spec/unit/route_spec.rb