Sha256: 81c0bb72cdd9a45e503dae0db19a21685d0fd5c8f45d77eec07fdb29d5456982

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Wikipedia, '.find' do
  it 'should return a Wikipedia::Page instance' do
    page = Wikipedia.find('Getting_Things_Done')
    expect(page).to be_an_instance_of(Wikipedia::Page)
  end

  it 'should return a Page with a title' do
    page = Wikipedia.find('Getting_Things_Done')
    expect(page.title).not_to be_nil
  end

  it 'should return a Page given a URL' do
    page1 = Wikipedia.find('Getting_Things_Done')

    page2 = Wikipedia.find('http://en.wikipedia.org/wiki/Getting_Things_Done')
    expect(page1.title).to eq(page2.title)
  end
end

describe Wikipedia, '.configure' do
  it 'should set configuration' do
    Wikipedia.configure do
      protocol 'https'
      domain 'zh.wikipedia.org'
    end

    page = Wikipedia.find('Getting_Things_Done')
    expect(page.fullurl).to start_with('https://zh.wikipedia.org')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wikipedia-client-1.17.0 spec/lib/wikipedia_spec.rb
wikipedia-client-1.16.0 spec/lib/wikipedia_spec.rb