Sha256: 7772b8563425161ca87b44bd9b18eb0316c26dd21722f822080efd578fd01cc1

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe "spec helper" do
  isolate :router, :conveyors
  
  before do
    rad.web
    rad.reset :conveyors
    
    load 'rad/profiles/web.rb'
    
    class ::Planes
      inherit Rad::Controller::Http
      
      def fly
        render inline: 'all right'
      end
    end
  end
  
  after :all do
    remove_constants :Planes
  end
      
  describe 'wcall' do
    it "basic usage" do
      wcall(Planes, :fly).should =~ /all right/
      wcall('/planes/fly').should =~ /all right/
    end 
    
    it "with :cycle scope" do
      wcall(Planes, :fly){|c|
        c.call
      }.should =~ /all right/
    end
    
    describe "set_wcall" do
      before :all do
        set_wcall controller: Planes
      end
      
      it "usage with handy shortcut" do
        wcall(:fly).should =~ /all right/
      end
    end
  end
  
  describe "routes" do
    before do
      router = rad[:router]
      router.routers.unshift :restful_router, Rad::Router::RestfulRouter.new
      router.routers[:restful_router].add :planes, class_name: 'Planes'
    end
    
    it "url_for, url_for_path" do
      url_for(Planes, :fly).should == "/planes/fly"
      url_for_path("/path", key: 'value').should == "/path?key=value"            
    end
    
    it "named routes" do
      fly_planes_path.should == "/planes/fly"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rad_core-0.0.25 spec/web/spec_helper_spec.rb
rad_core-0.0.24 spec/web/spec_helper_spec.rb
rad_core-0.0.23 spec/web/spec_helper_spec.rb
rad_core-0.0.22 spec/web/spec_helper_spec.rb
rad_core-0.0.21 spec/web/spec_helper_spec.rb
rad_core-0.0.20 spec/web/spec_helper_spec.rb
rad_core-0.0.19 spec/web/spec_helper_spec.rb
rad_core-0.0.18 spec/web/spec_helper_spec.rb
rad_core-0.0.17 spec/web/spec_helper_spec.rb
rad_core-0.0.16 spec/web/spec_helper_spec.rb
rad_core-0.0.15 spec/web/spec_helper_spec.rb
rad_core-0.0.14 spec/web/spec_helper_spec.rb