Stabilize social_relay_presenter_spec.rb

This commit is contained in:
Jonne Haß 2016-08-01 13:19:07 +02:00
parent dc0258f8a6
commit 48e5db8235
No known key found for this signature in database
GPG key ID: F347E0EB47AC70D6
2 changed files with 10 additions and 10 deletions

View file

@ -1,7 +1,7 @@
class SocialRelayPresenter class SocialRelayPresenter
def as_json(*) def as_json(*)
{ {
"subscribe" => AppConfig.relay.inbound.subscribe, "subscribe" => AppConfig.relay.inbound.subscribe?,
"scope" => AppConfig.relay.inbound.scope, "scope" => AppConfig.relay.inbound.scope,
"tags" => tags "tags" => tags
} }

View file

@ -30,10 +30,10 @@ describe SocialRelayPresenter do
end end
it "provides pod tags" do it "provides pod tags" do
expect(@presenter.as_json).to eq( expect(@presenter.as_json).to match(
"subscribe" => false, "subscribe" => false,
"scope" => "tags", "scope" => "tags",
"tags" => ["foo", "bar"] "tags" => a_collection_containing_exactly("foo", "bar")
) )
end end
end end
@ -46,15 +46,15 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo") lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag) FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
FactoryGirl.create(:tag_following, user: alice, tag: lootag) FactoryGirl.create(:tag_following, user: alice, tag: lootag)
alice.last_seen = Time.now - 2.month alice.last_seen = Time.zone.now - 2.months
alice.save alice.save
end end
it "provides user tags" do it "provides user tags" do
expect(@presenter.as_json).to eq( expect(@presenter.as_json).to match(
"subscribe" => false, "subscribe" => false,
"scope" => "tags", "scope" => "tags",
"tags" => ["cee", "loo"] "tags" => a_collection_containing_exactly("cee", "loo")
) )
end end
end end
@ -67,15 +67,15 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo") lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag) FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
FactoryGirl.create(:tag_following, user: alice, tag: lootag) FactoryGirl.create(:tag_following, user: alice, tag: lootag)
alice.last_seen = Time.now - 2.month alice.last_seen = Time.zone.now - 2.months
alice.save alice.save
end end
it "provides combined pod and user tags" do it "provides combined pod and user tags" do
expect(@presenter.as_json).to eq( expect(@presenter.as_json).to match(
"subscribe" => false, "subscribe" => false,
"scope" => "tags", "scope" => "tags",
"tags" => ["foo", "bar", "cee", "loo"] "tags" => a_collection_containing_exactly("foo", "bar", "cee", "loo")
) )
end end
end end
@ -88,7 +88,7 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo") lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag) FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
FactoryGirl.create(:tag_following, user: alice, tag: lootag) FactoryGirl.create(:tag_following, user: alice, tag: lootag)
alice.last_seen = Time.now - 8.month alice.last_seen = Time.zone.now - 8.months
alice.save alice.save
end end