From 0f0dd20139a045079d8585e0be841785b53bc85f Mon Sep 17 00:00:00 2001 From: Amanda Date: Fri, 8 Sep 2017 16:08:03 -0700 Subject: [PATCH 1/7] updated error message to i18t --- Gemfile.lock | 78 +++++++++++++-------------- lib/devise/uncommon_password/model.rb | 2 +- test/review_guide.md | 41 ++++++++++++++ 3 files changed, 81 insertions(+), 40 deletions(-) create mode 100644 test/review_guide.md diff --git a/Gemfile.lock b/Gemfile.lock index 9bcb24d..2c8b48a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,39 +8,39 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (5.1.2) - actionpack (= 5.1.2) + actioncable (5.1.4) + actionpack (= 5.1.4) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.2) - actionpack (= 5.1.2) - actionview (= 5.1.2) - activejob (= 5.1.2) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.2) - actionview (= 5.1.2) - activesupport (= 5.1.2) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.2) - activesupport (= 5.1.2) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.2) - activesupport (= 5.1.2) + activejob (5.1.4) + activesupport (= 5.1.4) globalid (>= 0.3.6) - activemodel (5.1.2) - activesupport (= 5.1.2) - activerecord (5.1.2) - activemodel (= 5.1.2) - activesupport (= 5.1.2) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) arel (~> 8.0) - activesupport (5.1.2) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -75,28 +75,28 @@ GEM mini_portile2 (~> 2.2.0) orm_adapter (0.5.0) rack (2.0.3) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.2) - actioncable (= 5.1.2) - actionmailer (= 5.1.2) - actionpack (= 5.1.2) - actionview (= 5.1.2) - activejob (= 5.1.2) - activemodel (= 5.1.2) - activerecord (= 5.1.2) - activesupport (= 5.1.2) - bundler (>= 1.3.0, < 2.0) - railties (= 5.1.2) + rack-test (0.7.0) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.1.2) - actionpack (= 5.1.2) - activesupport (= 5.1.2) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -107,12 +107,12 @@ GEM sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - thor (0.19.4) + thor (0.20.0) thread_safe (0.3.6) tzinfo (1.2.3) thread_safe (~> 0.1) @@ -132,4 +132,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 1.15.3 + 1.16.0.pre.1 diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index 683a202..d02985e 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -26,7 +26,7 @@ def self.common_passwords def not_common_password if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, "is a very common password. Please choose something harder to guess.") + errors.add(:password, I18n.t('errors.messages.common_password')) end end end diff --git a/test/review_guide.md b/test/review_guide.md new file mode 100644 index 0000000..8b74c6e --- /dev/null +++ b/test/review_guide.md @@ -0,0 +1,41 @@ +### Questions to ask when evaluating an influencer campaign  + +1. Why was working with influencers the right approach? +- Use the five benefits from the Introduction to Influencer Marketing lesson to +answer the question above: + - Build trust with consumers + - Save on content production + - Adapt content to local markets + - Target specific audiences + - Reach digital natives + +2. What’s the long-term plan for the brand relationship with these influencers? +- Influencer relationships pay dividends when they are nurtured over time.  +- If there is no plan for the future, that’s okay, but it should be a conscious +decision, not the result of poor relationship management!  + +3. How did you select these influencers? +- Use these criteria to make your selection: + - Their reach + - Their audience makeup  + - Their resonance + - Their relevance + - Their enthusiasm for your brand  + - Their professionalism  + +4. How did our influencer content performing compared to our brand content? Our digital +ads?  +- Compare the cost and effectiveness of your influencer content against your +brand’s content, digital ads, and any other tactics you find relevant.  +5. What did we learn from working with influencers about our brand and our target +market?  +- Ask your influencers what their followers thought of the campaign, and read the +comments left by their audience. + +6. What did we achieve? +- If the numbers aren’t good, be sure to determine some reasons why so that you +can find success in your next campaign. +7. How are we amplifying and reusing the content we got?  +- Don’t let high-quality content go to waste! +8. What should we do differently next time? +- Continue to stretch your goals as you build confidence in influencer marketing. From 00f6010159f9b274c8e550da723d5899905ce33e Mon Sep 17 00:00:00 2001 From: Amanda Date: Fri, 8 Sep 2017 16:15:45 -0700 Subject: [PATCH 2/7] fixed parens syntax error --- lib/devise/uncommon_password/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index d02985e..ba4fbf6 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -26,7 +26,7 @@ def self.common_passwords def not_common_password if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, I18n.t('errors.messages.common_password')) + errors.add(:password, I18n.t('errors.messages.common_password') end end end From 8873061641c9d14b58c377f6b86a0876b165ec23 Mon Sep 17 00:00:00 2001 From: Amanda Date: Fri, 8 Sep 2017 16:21:56 -0700 Subject: [PATCH 3/7] fixed parens syntax error a second time --- lib/devise/uncommon_password/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index ba4fbf6..d02985e 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -26,7 +26,7 @@ def self.common_passwords def not_common_password if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, I18n.t('errors.messages.common_password') + errors.add(:password, I18n.t('errors.messages.common_password')) end end end From 51106107ee0211737533a883389dc0d6307094a5 Mon Sep 17 00:00:00 2001 From: Amanda Date: Fri, 8 Sep 2017 16:31:06 -0700 Subject: [PATCH 4/7] changed test file message --- lib/devise/uncommon_password/model.rb | 6 +++++- test/devise/uncommon_password_test.rb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index d02985e..de1ce93 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -26,7 +26,11 @@ def self.common_passwords def not_common_password if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, I18n.t('errors.messages.common_password')) + errors.add(:password, def not_common_password + if Devise::Models::UncommonPassword.common_passwords.include? password.downcase + errors.add(:password, I18n.t('errors.messages.common_password')) + end + end) end end end diff --git a/test/devise/uncommon_password_test.rb b/test/devise/uncommon_password_test.rb index bffaaff..c644280 100644 --- a/test/devise/uncommon_password_test.rb +++ b/test/devise/uncommon_password_test.rb @@ -14,7 +14,11 @@ class Devise::UncommonPassword::Test < ActiveSupport::TestCase password = passwords.first.upcase user = User.create email:"example@example.org", password: password, password_confirmation: password assert_not user.valid?, "Uppercase common passwords shoud not be valid." - assert_equal ["is a very common password. Please choose something harder to guess."], user.errors[:password] + assert_equal [def not_common_password + if Devise::Models::UncommonPassword.common_passwords.include? password.downcase + errors.add(:password, I18n.t('errors.messages.common_password') + end + end], user.errors[:password] end test "should accept validation for an uncommon password" do From cc1fab3d7996c61f14b0bb6b90530a7c5501fc92 Mon Sep 17 00:00:00 2001 From: Amanda Date: Fri, 8 Sep 2017 19:21:24 -0700 Subject: [PATCH 5/7] deleted extra review_guide file --- test/review_guide.md | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 test/review_guide.md diff --git a/test/review_guide.md b/test/review_guide.md deleted file mode 100644 index 8b74c6e..0000000 --- a/test/review_guide.md +++ /dev/null @@ -1,41 +0,0 @@ -### Questions to ask when evaluating an influencer campaign  - -1. Why was working with influencers the right approach? -- Use the five benefits from the Introduction to Influencer Marketing lesson to -answer the question above: - - Build trust with consumers - - Save on content production - - Adapt content to local markets - - Target specific audiences - - Reach digital natives - -2. What’s the long-term plan for the brand relationship with these influencers? -- Influencer relationships pay dividends when they are nurtured over time.  -- If there is no plan for the future, that’s okay, but it should be a conscious -decision, not the result of poor relationship management!  - -3. How did you select these influencers? -- Use these criteria to make your selection: - - Their reach - - Their audience makeup  - - Their resonance - - Their relevance - - Their enthusiasm for your brand  - - Their professionalism  - -4. How did our influencer content performing compared to our brand content? Our digital -ads?  -- Compare the cost and effectiveness of your influencer content against your -brand’s content, digital ads, and any other tactics you find relevant.  -5. What did we learn from working with influencers about our brand and our target -market?  -- Ask your influencers what their followers thought of the campaign, and read the -comments left by their audience. - -6. What did we achieve? -- If the numbers aren’t good, be sure to determine some reasons why so that you -can find success in your next campaign. -7. How are we amplifying and reusing the content we got?  -- Don’t let high-quality content go to waste! -8. What should we do differently next time? -- Continue to stretch your goals as you build confidence in influencer marketing. From dd69d2b6a159df40651a777efbce087286367b7c Mon Sep 17 00:00:00 2001 From: Amanda Date: Sat, 9 Sep 2017 12:36:59 -0700 Subject: [PATCH 6/7] Error message for uncommon password updated --- lib/devise/uncommon_password/model.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index de1ce93..d02985e 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -26,11 +26,7 @@ def self.common_passwords def not_common_password if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, def not_common_password - if Devise::Models::UncommonPassword.common_passwords.include? password.downcase - errors.add(:password, I18n.t('errors.messages.common_password')) - end - end) + errors.add(:password, I18n.t('errors.messages.common_password')) end end end From 661b2150fb21b8f5a486aebc13f6cf02a511f1be Mon Sep 17 00:00:00 2001 From: Amanda Date: Thu, 14 Sep 2017 09:19:33 -0700 Subject: [PATCH 7/7] test --- lib/devise/uncommon_password/model.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/devise/uncommon_password/model.rb b/lib/devise/uncommon_password/model.rb index d02985e..24d5544 100644 --- a/lib/devise/uncommon_password/model.rb +++ b/lib/devise/uncommon_password/model.rb @@ -1,3 +1,4 @@ + module Devise module Models # The UncommonPassword module adds a new validation for Devise Models.