Sha256: aa04d461fdd5867d4d72ad114ab7a1342b82ad9ab1e76fe557f83b3fc2f1b968

Contents?: true

Size: 992 Bytes

Versions: 5

Compression:

Stored size: 992 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

5 entries across 5 versions & 1 rubygems

Version Path
cms_scanner-0.0.6 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.5 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.4 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.3 spec/shared_examples/target/platform/wordpress.rb
cms_scanner-0.0.2 spec/shared_examples/target/platform/wordpress.rb