for cross-posting to OAuth-enabled Wordpress.com or Jetpack-enabled Wordpress.org blogs. Added model for Wordpress service Added very very basic Wordpress cross-posting functionality. Added markdown support to post body Fixed Wordpress::MAX_CHARACTERS problem cleanup Added default settings for Wordpress OAuth Added default settings for Wordpress OAuth Added Wordpress to configured services spec. changelog changes
33 lines
1.1 KiB
Ruby
33 lines
1.1 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe Services::Wordpress do
|
|
|
|
before do
|
|
@user = alice
|
|
@post = @user.post(:status_message,
|
|
:text => "Hello there. This is a **Wordpress** post that we hope to turn into something else.",
|
|
:to => @user.aspects.first.id)
|
|
|
|
@service = Services::Wordpress.new(:nickname => "andrew",
|
|
:access_token => "abc123",
|
|
:uid => "123")
|
|
@user.services << @service
|
|
end
|
|
|
|
describe "#post" do
|
|
it 'posts a status message to wordpress' do
|
|
stub_request(:post, "https://public-api.wordpress.com/rest/v1/sites/123/posts/new").to_return(:status => 200, :body => {:ID => 68}.to_json, :headers => {})
|
|
@service.post(@post)
|
|
end
|
|
end
|
|
|
|
describe "#post_body" do
|
|
it "truncates content for use in title" do
|
|
@service.post_body(@post)[:title].should eq("Hello there. This is a Wordpress post...")
|
|
end
|
|
it "converts markdown tags" do
|
|
@service.post_body(@post)[:content].should match("<strong>Wordpress</strong>")
|
|
end
|
|
end
|
|
|
|
end
|