Sha256: c761c043256664a3df25bad7ebcb5fdf99b2d4eac8e5123fbf6d0368a5991863

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

describe WP::API do
  context "raw HTTP request" do
    let(:response) { HTTParty.get('http://wp.example.com/wp-json/posts/1').body }
    let(:file) { support_file('posts/1.json') }
    subject { parse_json(response) }

    it { should eq parse_json(file) }
  end

  context "/wp-json/post/:post" do

    let(:client) { WP::API['wp.example.com'] }

    subject { client.post(1) }
    
    it "should be a post" do
      expect(subject).to be_a WP::API::Post
    end

    it "should have correct IDs" do
      expect(subject.id).to eq 1
    end

    it "should have correct author" do
      expect(subject.author.id).to eq 2
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wp-api-0.0.2 spec/endpoints/post_spec.rb