Sha256: a16d99d1d6380a349eb9bc74e612896371e12c20200530faf6fbd6a52f641af8

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

require "spec_helper"
require "espago/router"

class Espago::ApiConnection::GetStubbedRequest; end

describe Espago::Router do
  subject { Espago::Router.new(:stubbed_request, :get) }

  it { subject.should respond_to :path}
  it { subject.should respond_to :method}

  context "#route" do
    it "should get a class name depending on path and method" do
      subject.route.should eq( Espago::ApiConnection::GetStubbedRequest )
    end

    it "should raise error if class not found" do
      subject { Espago::Router.new(:not, :existing) }
      expect { subject.route.to raise_error( Espago::Router::NoPathError ) }
    end
  end

  context "#path_exists?" do
    it "should return if path exists" do
      subject.path_exists?.should be_true
    end

    context "with invalid path name" do
      subject { Espago::Router.new(:not, :existing) }

      it "should return false" do
        subject.path_exists?.should_not be_true
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
espago-0.0.9 spec/espago/router_spec.rb
espago-0.0.7 spec/espago/router_spec.rb
espago-0.0.6 spec/espago/router_spec.rb