Sha256: 7088f4608c1f468aa30a7444bdf3723fc6707e6d123332dd2631843f8d611ba5

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'
require 'ronin/exploits/metadata/url_query_param'

describe Ronin::Exploits::Metadata::URLQueryParam do
  describe ".url_query_param" do
    subject { test_class }

    context "and when url_query_param is not set in the class" do
      module TestMetadataURLQueryParam
        class WithNoURLQueryParamSet
          include Ronin::Exploits::Metadata::URLQueryParam
        end
      end

      let(:test_class) { TestMetadataURLQueryParam::WithNoURLQueryParamSet }

      it "must default to nil" do
        expect(subject.url_query_param).to be(nil)
      end
    end

    context "and when url_query_param is set in the class" do
      module TestMetadataURLQueryParam
        class WithURLQueryParamSet
          include Ronin::Exploits::Metadata::URLQueryParam

          url_query_param 'test'
        end
      end

      let(:test_class) { TestMetadataURLQueryParam::WithURLQueryParamSet }

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

    context "but when the url_query_param was set in the superclass" do
      module TestMetadataURLQueryParam
        class InheritsItsURLQueryParam < WithURLQueryParamSet
        end
      end

      let(:test_class) { TestMetadataURLQueryParam::InheritsItsURLQueryParam }

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

      context "but the url_query_param is overridden in the sub-class" do
        module TestMetadataURLQueryParam
          class OverridesItsInheritedURLQueryParam < WithURLQueryParamSet
            url_query_param "test2"
          end
        end

        let(:test_class) do
          TestMetadataURLQueryParam::OverridesItsInheritedURLQueryParam
        end

        it "must return the url_query_param set in the sub-class" do
          expect(subject.url_query_param).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_query_param_spec.rb
ronin-exploits-1.0.0.beta1 spec/metadata/url_query_param_spec.rb