parent
4b949491df
commit
2aaff56e14
8 changed files with 16 additions and 16 deletions
|
|
@ -6,10 +6,10 @@ module DiasporaFederation
|
|||
class StatusMessage < Entity
|
||||
include Post
|
||||
|
||||
# @!attribute [r] raw_message
|
||||
# @!attribute [r] text
|
||||
# Text of the status message composed by the user
|
||||
# @return [String] text of the status message
|
||||
property :raw_message
|
||||
property :text, xml_name: :raw_message
|
||||
|
||||
# @!attribute [r] photos
|
||||
# Optional photos attached to the status message
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ module DiasporaFederation
|
|||
end
|
||||
|
||||
factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do
|
||||
raw_message "i am a very interesting status update"
|
||||
text "i am a very interesting status update"
|
||||
author { generate(:diaspora_id) }
|
||||
guid
|
||||
public(true)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module DiasporaFederation
|
|||
|
||||
rule :guid, :guid
|
||||
|
||||
rule :raw_message, length: {maximum: 65_535}
|
||||
rule :text, length: {maximum: 65_535}
|
||||
|
||||
rule :photos, :not_nil
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ module DiasporaFederation
|
|||
expect(entity).to be_a(Entities::StatusMessage)
|
||||
expect(entity.guid).to eq(guid)
|
||||
expect(entity.author).to eq(alice.diaspora_id)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(magic_env.sender).to eq(alice.diaspora_id)
|
||||
end
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ module DiasporaFederation
|
|||
expect(entity).to be_a(Entities::StatusMessage)
|
||||
expect(entity.guid).to eq(guid)
|
||||
expect(entity.author).to eq(alice.diaspora_id)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(magic_env.sender).to eq(alice.diaspora_id)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ module DiasporaFederation
|
|||
<guid>#{data[:guid]}</guid>
|
||||
<created_at>#{data[:created_at]}</created_at>
|
||||
<provider_display_name>#{data[:provider_display_name]}</provider_display_name>
|
||||
<raw_message>#{data[:raw_message]}</raw_message>
|
||||
<raw_message>#{data[:text]}</raw_message>
|
||||
<photo>
|
||||
<guid>#{photo1.guid}</guid>
|
||||
<diaspora_handle>#{photo1.author}</diaspora_handle>
|
||||
|
|
@ -67,7 +67,7 @@ module DiasporaFederation
|
|||
<author>#{data[:author]}</author>
|
||||
<guid>#{data[:guid]}</guid>
|
||||
<created_at>#{data[:created_at]}</created_at>
|
||||
<raw_message>#{data[:raw_message]}</raw_message>
|
||||
<text>#{data[:text]}</text>
|
||||
</status_message>
|
||||
XML
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ module DiasporaFederation
|
|||
) do |magic_env|
|
||||
expect(magic_env.payload.guid).to eq(post.guid)
|
||||
expect(magic_env.payload.author).to eq(post.author)
|
||||
expect(magic_env.payload.raw_message).to eq(post.raw_message)
|
||||
expect(magic_env.payload.text).to eq(post.text)
|
||||
expect(magic_env.payload.public).to eq("true")
|
||||
receiver
|
||||
end
|
||||
|
|
@ -41,7 +41,7 @@ module DiasporaFederation
|
|||
) do |magic_env|
|
||||
expect(magic_env.payload.guid).to eq(post.guid)
|
||||
expect(magic_env.payload.author).to eq(post.author)
|
||||
expect(magic_env.payload.raw_message).to eq(post.raw_message)
|
||||
expect(magic_env.payload.text).to eq(post.text)
|
||||
expect(magic_env.payload.public).to eq("true")
|
||||
receiver
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module DiasporaFederation
|
|||
expect_callback(:receive_entity, kind_of(Entities::StatusMessage), nil) do |_, entity|
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
expect(entity.author).to eq(post.author)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(entity.public).to eq("true")
|
||||
end
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ module DiasporaFederation
|
|||
expect_callback(:receive_entity, kind_of(Entities::StatusMessage), nil) do |_, entity|
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
expect(entity.author).to eq(post.author)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(entity.public).to eq("true")
|
||||
end
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ module DiasporaFederation
|
|||
expect_callback(:receive_entity, kind_of(Entities::StatusMessage), 1234) do |_, entity|
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
expect(entity.author).to eq(post.author)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(entity.public).to eq("false")
|
||||
end
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ module DiasporaFederation
|
|||
expect_callback(:receive_entity, kind_of(Entities::StatusMessage), 1234) do |_, entity|
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
expect(entity.author).to eq(post.author)
|
||||
expect(entity.raw_message).to eq(post.raw_message)
|
||||
expect(entity.text).to eq(post.text)
|
||||
expect(entity.public).to eq("false")
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ module DiasporaFederation
|
|||
let(:property) { :public }
|
||||
end
|
||||
|
||||
describe "#raw_message" do
|
||||
describe "#text" do
|
||||
it_behaves_like "a property with a value validation/restriction" do
|
||||
let(:property) { :raw_message }
|
||||
let(:property) { :text }
|
||||
let(:wrong_values) { ["a" * 65_536] }
|
||||
let(:correct_values) { ["a" * 65_535, nil, ""] }
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue