Sha256: ed4efc26512ffe160ea3f598a86828567b2ed7e1c102a234902056bb311d7366

Contents?: true

Size: 812 Bytes

Versions: 9

Compression:

Stored size: 812 Bytes

Contents

require 'spec_helper'

module Pageflow
  module Chart
    describe 'scraping site', :inline_resque => true do
      before do
        stub_request(:get, "http://example.com/chart.html")
          .to_return(:status => 200, :body => File.read('spec/fixtures/datawrapper.html'))
        stub_request(:get, /js$|css$|csv$/)
          .to_return(:status => 200, :body => 'file')
      end

      it 'downloads html and dependencies' do
        post('/charts/scraped_sites', scraped_site: {url: 'http://example.com/chart.html'}, format: 'json')

        expect(ScrapedSite.first.html_file).to be_present
        expect(ScrapedSite.first.javascript_file).to be_present
        expect(ScrapedSite.first.stylesheet_file).to be_present
        expect(ScrapedSite.first.csv_file).to be_present
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pageflow-chart-1.2.0 spec/requests/scraping_site_spec.rb
pageflow-chart-1.1.0 spec/requests/scraping_site_spec.rb
pageflow-chart-1.0.1 spec/requests/scraping_site_spec.rb
pageflow-chart-1.0.0 spec/requests/scraping_site_spec.rb
pageflow-chart-0.2.2 spec/requests/scraping_site_spec.rb
pageflow-chart-0.2.1 spec/requests/scraping_site_spec.rb
pageflow-chart-0.2.0 spec/requests/scraping_site_spec.rb
pageflow-chart-0.1.1 spec/requests/scraping_site_spec.rb
pageflow-chart-0.1.0 spec/requests/scraping_site_spec.rb