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
def as_json(*)
{
"subscribe" => AppConfig.relay.inbound.subscribe,
"subscribe" => AppConfig.relay.inbound.subscribe?,
"scope" => AppConfig.relay.inbound.scope,
"tags" => tags
}

View file

@ -30,10 +30,10 @@ describe SocialRelayPresenter do
end
it "provides pod tags" do
expect(@presenter.as_json).to eq(
expect(@presenter.as_json).to match(
"subscribe" => false,
"scope" => "tags",
"tags" => ["foo", "bar"]
"tags" => a_collection_containing_exactly("foo", "bar")
)
end
end
@ -46,15 +46,15 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
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
end
it "provides user tags" do
expect(@presenter.as_json).to eq(
expect(@presenter.as_json).to match(
"subscribe" => false,
"scope" => "tags",
"tags" => ["cee", "loo"]
"tags" => a_collection_containing_exactly("cee", "loo")
)
end
end
@ -67,15 +67,15 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
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
end
it "provides combined pod and user tags" do
expect(@presenter.as_json).to eq(
expect(@presenter.as_json).to match(
"subscribe" => false,
"scope" => "tags",
"tags" => ["foo", "bar", "cee", "loo"]
"tags" => a_collection_containing_exactly("foo", "bar", "cee", "loo")
)
end
end
@ -88,7 +88,7 @@ describe SocialRelayPresenter do
lootag = FactoryGirl.create(:tag, name: "loo")
FactoryGirl.create(:tag_following, user: alice, tag: ceetag)
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
end