diff --git a/app/helpers/atom_builder_helper.rb b/app/helpers/atom_builder_helper.rb
index 0cfc438ac4..40d1119c9c 100644
--- a/app/helpers/atom_builder_helper.rb
+++ b/app/helpers/atom_builder_helper.rb
@@ -3,7 +3,7 @@ module AtomBuilderHelper
@account.stream_entries.last ? (@account.updated_at > @account.stream_entries.last.created_at ? @account.updated_at : @account.stream_entries.last.created_at) : @account.updated_at
end
- def entry(xml, is_root, &block)
+ def entry(xml, is_root = false, &block)
if is_root
root_tag(xml, :entry, &block)
else
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1c19f08b28..1ef379f40d 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -15,6 +15,7 @@ Rails.application.configure do
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
+ config.assets.digest = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
diff --git a/spec/helpers/atom_builder_helper_spec.rb b/spec/helpers/atom_builder_helper_spec.rb
index 04dda6f37c..0cc9522752 100644
--- a/spec/helpers/atom_builder_helper_spec.rb
+++ b/spec/helpers/atom_builder_helper_spec.rb
@@ -6,95 +6,148 @@ RSpec.describe AtomBuilderHelper, type: :helper do
end
describe '#entry' do
- pending
+ it 'creates an entry' do
+ expect(used_in_builder { |xml| helper.entry(xml) }).to match ''
+ end
end
describe '#feed' do
- pending
+ it 'creates a feed' do
+ expect(used_in_builder { |xml| helper.feed(xml) }).to match ''
+ end
end
describe '#unique_id' do
- pending
+ it 'creates an id' do
+ time = Time.now
+ expect(used_in_builder { |xml| helper.unique_id(xml, time, 1, 'Status') }).to match "#{helper.unique_tag(time, 1, 'Status')}"
+ end
end
describe '#simple_id' do
- pending
+ it 'creates an id' do
+ expect(used_in_builder { |xml| helper.simple_id(xml, 1) }).to match '1'
+ end
end
describe '#published_at' do
- pending
+ it 'creates a published tag' do
+ time = Time.now
+ expect(used_in_builder { |xml| helper.published_at(xml, time) }).to match "#{time.iso8601}"
+ end
end
describe '#updated_at' do
- pending
+ it 'creates an updated tag' do
+ time = Time.now
+ expect(used_in_builder { |xml| helper.updated_at(xml, time) }).to match "#{time.iso8601}"
+ end
end
describe '#verb' do
- pending
+ it 'creates an entry' do
+ expect(used_with_namespaces { |xml| helper.verb(xml, 'verb') }).to match 'http://activitystrea.ms/schema/1.0/verb'
+ end
end
describe '#content' do
- pending
+ it 'creates a content' do
+ expect(used_in_builder { |xml| helper.content(xml, 'foo') }).to match 'foo'
+ end
end
describe '#title' do
- pending
+ it 'creates a title' do
+ expect(used_in_builder { |xml| helper.title(xml, 'foo') }).to match '
foo'
+ end
end
describe '#author' do
- pending
+ it 'creates an author' do
+ expect(used_in_builder { |xml| helper.author(xml) }).to match ''
+ end
end
describe '#target' do
- pending
+ it 'creates a target' do
+ expect(used_with_namespaces { |xml| helper.target(xml) }).to match ''
+ end
end
describe '#object_type' do
- pending
+ it 'creates an object type' do
+ expect(used_with_namespaces { |xml| helper.object_type(xml, 'test') }).to match 'http://activitystrea.ms/schema/1.0/test'
+ end
end
describe '#uri' do
- pending
+ it 'creates a uri' do
+ expect(used_in_builder { |xml| helper.uri(xml, 1) }).to match '1'
+ end
end
describe '#name' do
- pending
+ it 'creates a name' do
+ expect(used_in_builder { |xml| helper.name(xml, 1) }).to match '1'
+ end
end
describe '#summary' do
- pending
+ it 'creates a summary' do
+ expect(used_in_builder { |xml| helper.summary(xml, 1) }).to match '1'
+ end
end
describe '#subtitle' do
- pending
+ it 'creates a subtitle' do
+ expect(used_in_builder { |xml| helper.subtitle(xml, 1) }).to match '1'
+ end
end
describe '#link_alternate' do
- pending
+ it 'creates a link' do
+ expect(used_in_builder { |xml| helper.link_alternate(xml, 1) }).to match ''
+ end
end
describe '#link_self' do
- pending
+ it 'creates a link' do
+ expect(used_in_builder { |xml| helper.link_self(xml, 1) }).to match ''
+ end
end
describe '#link_hub' do
- pending
+ it 'creates a link' do
+ expect(used_in_builder { |xml| helper.link_hub(xml, 1) }).to match ''
+ end
end
describe '#link_salmon' do
- pending
+ it 'creates a link' do
+ expect(used_in_builder { |xml| helper.link_salmon(xml, 1) }).to match ''
+ end
end
describe '#portable_contact' do
- pending
+ let(:account) { Fabricate(:account, username: 'alice', display_name: 'Alice in Wonderland') }
+
+ it 'creates portable contacts entries' do
+ expect(used_with_namespaces { |xml| helper.portable_contact(xml, account) }).to match 'Alice in Wonderland'
+ end
end
describe '#in_reply_to' do
- pending
+ it 'creates a thread' do
+ expect(used_with_namespaces { |xml| helper.in_reply_to(xml, 'uri', 'url') }).to match ''
+ end
end
describe '#link_mention' do
- pending
+ let(:account) { Fabricate(:account, username: 'alice') }
+
+ it 'creates a link' do
+ expect(used_in_builder { |xml| helper.link_mention(xml, account) }).to match ''
+ end
end
describe '#disambiguate_uri' do
@@ -114,10 +167,25 @@ RSpec.describe AtomBuilderHelper, type: :helper do
end
describe '#link_avatar' do
- pending
+ let(:account) { Fabricate(:account, username: 'alice') }
+
+ it 'creates a link' do
+ expect(used_with_namespaces { |xml| helper.link_avatar(xml, account) }).to match ''
+ end
end
describe '#logo' do
- pending
+ it 'creates a logo' do
+ expect(used_in_builder { |xml| helper.logo(xml, 1) }).to match '1'
+ end
+ end
+
+ def used_in_builder(&block)
+ builder = Nokogiri::XML::Builder.new(&block)
+ builder.doc.root.to_xml
+ end
+
+ def used_with_namespaces(&block)
+ used_in_builder { |xml| helper.entry(xml, true, &block) }
end
end