docbrown/spec/factories/broadcasts.rb
Fernando Valverde fcc5c0d2a1
Add Sign in with Apple (#11934)
* Add gem omniauth-apple

* Integrate omniauth-apple

* Integrate callback

* Add fields

* Add tests, fix bugs and make it all work

* Show only enabled providers for the current user

* Add default profile image for Apple

* Remove localhost patch

* Bring over the changed Apple username if the user changes it

* More specs fixed

* Incorporate feedback from PR

* Fix specs

* Simplify code and fix spec

* Fix Broadcast generators to take into account the new provider

* Fix spec

* Generate a truly unique apple_username

* Fix user specs

* Add omniauth-apple-0.0.2 to vendor cache

* Fix merge conflict and spec

* Update VCR fastly sloan cassette

* Revert "Generate a truly unique apple_username"

This reverts commit 2462875575b0bbd6b3c1d56b25afcd3189671608.

* Fix user specs

* Fix specs

* Fix specs

* Hide Connect Apple button behind a feature flag

* Revert "Hide Connect Apple button behind a feature flag"

This reverts commit 105bde0373389a4eb9b6e948f60734c7e0e99cba.

* Fix line lengths

* Fix spec

* ES tag

* CSRF bypass for Apple callback

* custom user_nickname in Apple provider with small tweaks + omniauth-apple bump

* Fixes username specs

* Makes Apple users default image Users::ProfileImageGenerator

* Fallback to mascot_image_url in test environment to avoid breaking Travis

* Fixes Apple CSRF error + makes default nickname more readable

* Trigger Travis

* Better devise config

* Apple SiteConfig entires in /admin/config

* Fixing specs

* Adds beta_access? to Authentication::Providers::Provider

* Fixes specs

* Codeclimate double quote fix in Gemfile

* Fixes /admin/config allowed params & adds feature flag for provider beta_access?

* Remove Enfile & adds temporary docs

* Adds custom apple auth provider settings

* Fix authenticator spec

* Fix configs spec (use last instead of first to avoid apple special case)

* Remove dangling fields from /admin/config

* updates feature flag

* More test fixes

* Hide config behind feature flag too

* omniauth-apple bump

* Takes care of edge case fallback

* Reverse apple_username update

* Adds auth_time to info hash in apple omniauth mock

* Switch to next instead of nesting for feature flag

* Fixes CVE-2015-9284

* Fixes specs after auth providers initiatior refactor from GET to POST

* Spec fixes

* More spec fixes

* Fix Rails codebase reference link

Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: rhymes <rhymes@hey.com>
2020-12-18 10:22:33 -06:00

135 lines
5.3 KiB
Ruby

FactoryBot.define do
factory :broadcast do
active { true }
active_status_updated_at { 2.days.ago }
factory :set_up_profile_broadcast do
title { "Welcome Notification: set_up_profile" }
type_of { "Welcome" }
processed_html do
"Welcome to DEV! 👋 I'm <a href='https://dev.to/sloan'>Sloan</a>, " \
"the community mascot and I'm here to help get you started. " \
"Let's begin by <a href='https://dev.to/settings'>setting up your profile</a>!"
end
end
factory :welcome_broadcast do
title { "Welcome Notification: welcome_thread" }
type_of { "Welcome" }
processed_html do
"Sloan here again! 👋 DEV is a friendly community. " \
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
end
end
factory :apple_connect_broadcast do
title { "Welcome Notification: apple_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have an Apple account? Consider <a href='/settings'>connecting it</a>."
end
end
factory :github_connect_broadcast do
title { "Welcome Notification: github_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a GitHub account? Consider " \
"<a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
end
end
factory :facebook_connect_broadcast do
title { "Welcome Notification: facebook_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Facebook account? Consider " \
"<a href='/settings'>connecting it</a>."
end
end
factory :twitter_connect_broadcast do
title { "Welcome Notification: twitter_connect" }
type_of { "Welcome" }
processed_html do
"You're on a roll! 🎉 Do you have a Twitter account? Consider " \
"<a href='/settings'>connecting it</a> so we can @mention you if we share " \
"your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
end
end
factory :customize_ux_broadcast do
title { "Welcome Notification: customize_experience" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
end
end
factory :customize_feed_broadcast do
title { "Welcome Notification: customize_feed" }
type_of { "Welcome" }
processed_html do
"Hi, it's me again! 👋 Now that you're a part of the DEV community, " \
"let's focus on personalizing your content. You can start by " \
"<a href='/tags'>following some tags</a> to help customize your feed! 🎉"
end
end
factory :start_discussion_broadcast do
title { "Welcome Notification: start_discussion" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
"Starting a discussion is easy to do; just click on 'Write a Post' " \
"in the sidebar of the tag page to get started!"
end
end
factory :ask_question_broadcast do
title { "Welcome Notification: ask_question" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. " \
"Asking a question is easy to do; just click on 'Write a Post' in the sidebar of the tag page to get started!"
end
end
factory :discuss_and_ask_broadcast do
title { "Welcome Notification: discuss_and_ask" }
type_of { "Welcome" }
processed_html do
"Sloan here! 👋 I noticed that you haven't " \
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
"It's easy to do both of these; just click on 'Write a Post' in the sidebar of the tag page to get started!"
end
end
factory :download_app_broadcast do
title { "Welcome Notification: download_app" }
type_of { "Welcome" }
processed_html do
"Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile " \
"app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it " \
"so you can access all of your favorite DEV content on the go!"
end
end
factory :announcement_broadcast do
title { "A Very Important Announcement" }
type_of { "Announcement" }
processed_html { "<p>Hello, World!</p>" }
end
trait :with_tracking do
processed_html do
"Sloan here again! 👋 DEV is a friendly community. Why not introduce " \
"yourself by leaving a comment in <a href='/welcome' onclick='trackNotification(event)'>the welcome thread</a>!"
end
end
end
end