Stabilize social_relay_presenter_spec.rb
This commit is contained in:
parent
dc0258f8a6
commit
48e5db8235
2 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue