Sha256: 54ea92d108f399aa82737200844e016870111f1ddea885074cf49f6f8ae76b69

Contents?: true

Size: 1.72 KB

Versions: 2

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
require 'ronin/exploits/metadata/url_path'

describe Ronin::Exploits::Metadata::URLPath do
  describe ".url_path" do
    subject { test_class }

    context "and when url_path is not set in the class" do
      module TestMetadataURLPath
        class WithNoURLPathSet
          include Ronin::Exploits::Metadata::URLPath
        end
      end

      let(:test_class) { TestMetadataURLPath::WithNoURLPathSet }

      it "must default to '/'" do
        expect(subject.url_path).to eq('/')
      end
    end

    context "and when url_path is set in the class" do
      module TestMetadataURLPath
        class WithURLPathSet
          include Ronin::Exploits::Metadata::URLPath

          url_path '/test'
        end
      end

      let(:test_class) { TestMetadataURLPath::WithURLPathSet }

      it "must return the set url_path" do
        expect(subject.url_path).to eq("/test")
      end
    end

    context "but when the url_path was set in the superclass" do
      module TestMetadataURLPath
        class InheritsItsURLPath < WithURLPathSet
        end
      end

      let(:test_class) { TestMetadataURLPath::InheritsItsURLPath }

      it "must return the url_path set in the superclass" do
        expect(subject.url_path).to eq("/test")
      end

      context "but the url_path is overridden in the sub-class" do
        module TestMetadataURLPath
          class OverridesItsInheritedURLPath < WithURLPathSet
            url_path "/test2"
          end
        end

        let(:test_class) do
          TestMetadataURLPath::OverridesItsInheritedURLPath
        end

        it "must return the url_path set in the sub-class" do
          expect(subject.url_path).to eq("/test2")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ronin-exploits-1.0.0.beta2 spec/metadata/url_path_spec.rb
ronin-exploits-1.0.0.beta1 spec/metadata/url_path_spec.rb