Sha256: 2de0709c5eca06a078280751eb3a700ae6e8692658431c176fd6b94d47b9a01b

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require "controller/spec_helper"

describe "spec helper" do
  with_environment
  with_http
  with_router
  
  before :all do
    load 'rad/profiles/web.rb'
    
    class ::Planes
      inherit Rad::HttpController
      
      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 :each do
      router = rad[:router]
      router.routes.unshift :restful_router, Rad::RestfulRouter.new
      router.routes[:restful_router].add :planes, class: 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

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 spec/integration/spec_helper_spec.rb