Sha256: 4636dd9005d5d142dc7f979e17748dd9ff8f258a21016cb9171b2e1859de0450

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require "spec_helper"

describe "humans.rb" do

  before do
    @humans = HumansRb.new load_fixture("humans.txt")
  end

  it "should return the string if passed" do
    expect(HumansRb.new("foo").body).to eql("foo\n")
  end

  it "should return the body if a URL is passed" do
    stub_request(:get, "http://ben.balter.com/humans.txt").
      to_return(:status => 200, :body => "foo", :headers => {})

    expect(HumansRb.new("http://ben.balter.com/humans.txt").body).to eql("foo\n")
  end

  it "should return headings" do
    output = @humans.parse
    expect(output.count).to eql(2)
  end

  it "should parse the humanstxt.org humans.txt file" do
    humans = HumansRb.new(load_fixture("humansorg.txt")).parse
    expect(humans).to_not be_nil
    expect(humans[:team]).to_not be_nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
humans_rb-0.0.4 spec/humans_rb_spec.rb