Sha256: c04d91282669f2fb9fe9a96ac475198aa995b276c507f14efc8ee292f8cf33fc
Contents?: true
Size: 1.98 KB
Versions: 3
Compression:
Stored size: 1.98 KB
Contents
require 'spec/spec_helper' begin shared_examples_for "A controller routed as an AssetsController" do # describe "A controller routed as an AssetsController", :shared => true do attr_reader :prefix, :format describe "routing" do attr_reader :path, :route context "given a simple path" do before do @path = "/#{prefix}/asset.#{format}" @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'asset', :format => format } end it "recognizes the path" do params_from(:get, path).should == route end it "generates the path from a URL helper" do send("#{prefix}_path", :asset, :format => format).should == path end end context "given a complex path of nested directories" do before do @path = "/#{prefix}/path/to/asset.#{format}" @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path/to/asset', :format => format } end it "recognizes the path" do params_from(:get, path).should == route end it "generates the path from a URL helper" do CGI.unescape(send("#{prefix}_path", 'path/to/asset', :format => format)).should == CGI.unescape(path) end end context "given a complex path of dotted components" do before do @path = "/#{prefix}/path.to/asset.one.#{format}" @route = { :controller => "engine_assets/#{prefix}", :action => 'show', :path => 'path.to/asset.one', :format => format } end it "recognizes the path" do params_from(:get, path).should == route end it "generates the path from a URL helper" do CGI.unescape(send("#{prefix}_path", 'path.to/asset.one', :format => format)).should == CGI.unescape(path) end end end end rescue ArgumentError puts "WARNING: #{__FILE__}:#{__LINE__} trying to load this file twice, for some reason" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
engine-assets-0.6.0.pre1 | spec/shared/assets_routing_spec.rb |
engine-assets-0.5.1 | spec/shared/assets_routing_spec.rb |
engine-assets-0.5.0 | spec/shared/assets_routing_spec.rb |