Sha256: 5fa6ad6c817d6d8ee19c27634417bb77598f812c099a7c10443f549c1e9d79b0

Contents?: true

Size: 990 Bytes

Versions: 3

Compression:

Stored size: 990 Bytes

Contents

require_relative 'wordpress/custom_directories'

shared_examples CMSScanner::Target::Platform::WordPress do
  it_behaves_like 'WordPress::CustomDirectories'

  describe '#wordpress?' do
    let(:fixtures) { File.join(super(), 'detection') }

    before do
      stub_request(:get, target.url).to_return(body: File.read(File.join(fixtures, "#{body}.html")))
    end

    %w(default wp_includes).each do |file|
      context "when a wordpress page (#{file}.html)" do
        let(:body) { file }

        its(:wordpress?) { should be true }
      end
    end

    %w(not_wp).each do |file|
      context "when not a wordpress page (#{file}.html)" do
        let(:body) { file }

        its(:wordpress?) { should be false }
      end
    end
  end

  describe '#wordpress_hosted?' do
    its(:wordpress_hosted?) { should be false }

    context 'when the target host matches' do
      let(:url) { 'http://ex.wordpress.com' }

      its(:wordpress_hosted?) { should be true }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cms_scanner-0.0.9 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.8 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.7 spec/shared_examples/target/platform/wordpress.rb