Sha256: 48b714977e3e2b4bc8504a9ff8848e7d8305e6c67d604ae9b6248b221e542d37

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

require_relative "../spec_helper"

require_relative "../../lib/shared_count/cli"

describe SharedCount::Cli do
  describe ".run" do
    let(:lines) do
      ["http://slashdot.org\n", "http://bbc.co.uk\n", "http://www.lanacion.com.ar\n", "http://www.theguardian.com\n"]
    end

    it "queries the SharedCount API for each URL passed in" do
      csv = SharedCount::Cli.run(lines)

      arr = CSV.parse(csv, headers: :first_row)
      urls = [arr[1]["URL"], arr[2]["URL"], arr[3]["URL"], arr[4]["URL"]]
      lines.each do |line|
        line.chomp!
        urls.any? { |url| url == line }.must_be_same_as true
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shared_count-cli-0.0.3 spec/shared_count/cli_spec.rb
shared_count-cli-0.0.2 spec/shared_count/cli_spec.rb