[rspec-users] RSpec 2, Rails 3, and SSL routes

Brian Ploetz bploetz at gmail.com
Mon Dec 13 08:55:25 EST 2010


Anybody?

On Dec 9, 3:22 pm, Brian Ploetz <bplo... at gmail.com> wrote:
> Hi all,
>
> This is probably a stupid question, but I can't figure out how to do
> this.....
>
> If I have some routes which require SSL, how do I test that with
> RSpec? For example:
>
> # routes.rb
> scope :constraints => { :protocol => "https" } do
>   match '/foos.(:format)' => 'foos#index', :via => :get, :constraints
> => { :format => /(json|xml)/ }
> end
>
> In my routing spec, I've tried the following variants with no luck:
>
> describe "routing to foos" do
>   it "routes /foos.json to foos#index" do
>     { :get => "/foos.json", :protocol => "https" }.should route_to(
>       :controller => "foos",
>       :action => "index",
>       :format => "json"
>     )
>   end
>
> describe "routing to foos" do
>   it "routes /foos.json to foos#index" do
>     { :get => "/foos.json" }.should route_to(
>       :controller => "foos",
>       :action => "index",
>       :format => "json",
>       :protocol => "https"
>     )
>   end
>
> Thanks in advance for any help.
> BP
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list