Sha256: 56353d6c4aa026024262c7f8e83f17fbaf31052865fe800fcbaa0501021846a3

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe Docushin::Route do
  let(:route_set) { Docushin::RouteSet.new }
  let(:route) { route_set.routes.first }

  describe 'create a new Route' do
    it 'should have name, verb, path, requirements, data, content as attr' do 
      route.should respond_to(:name)
      route.should respond_to(:verb)
      route.should respond_to(:path)
      route.should respond_to(:requirements)
      route.should respond_to(:base)
      route.should respond_to(:data)
      route.should respond_to(:file_name)
      route.should respond_to(:content)
      route.should respond_to(:description)
    end
  end

  describe 'inspect the new Route' do 
    it 'should have attr defined' do 
      route.base.should == File.join(Rails.root, 'doc', 'docushin')
      route.file_name.should == Digest::MD5.hexdigest(route.verb.to_s + route.path) 
      route.name.should == "foo_index"
      route.path.should == "/foo"
      route.requirements.should == {:action=>"index", :controller=>"foo"}
      route.verb.should == "GET"
    end    
  end

  describe 'read markdown file' do
    it 'should generate data and content' do 
      route.data.should == {"description"=>"I am so awesome"}
      route.description.should == "I am so awesome"
      route.content.should == "{\"id\":\"4f3a296ac8de6732fe000003\",\"first_name\":\"Todor\",\"last_name\":\"Grudev\",\"username\":null,\"bio\":null,\"gender\":\"male\",\"email\":\"tagrudev@gmail.com\"}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docushin-0.0.1 spec/docushin/route_spec.rb