From 5068be90e858bf595314ae7e195f726128537988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sun, 1 Jun 2014 23:50:17 +0200 Subject: [PATCH] reduce cuke failures * Bump sass-rails (without effect) * Bump mobile-fu (without effect) * Cosmetically fix two cukes * Refactor Taggable#tag_strings * Rename default.css to default.css.scss (without effect) * Fix receiving a conversation * Pass aspect_ids instead of a relation to User#aspects_from_ids --- Gemfile | 2 +- Gemfile.lock | 15 ++++++++------- .../stylesheets/{default.css => default.css.scss} | 0 app/models/conversation.rb | 2 +- app/models/user.rb | 2 +- features/desktop/closes_account.feature | 2 ++ features/desktop/profile_photos.feature | 2 ++ features/step_definitions/posts_steps.rb | 6 +++--- lib/diaspora/taggable.rb | 14 ++++---------- 9 files changed, 22 insertions(+), 23 deletions(-) rename app/assets/stylesheets/{default.css => default.css.scss} (100%) diff --git a/Gemfile b/Gemfile index 5c540a40d..4fe66bbbc 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,7 @@ gem 'rack-cors', '0.2.9', :require => 'rack/cors' gem 'bootstrap-sass', '2.3.2.2' gem 'compass-rails', '1.1.7' -gem 'sass-rails', '4.0.1' +gem 'sass-rails', '4.0.3' # Database diff --git a/Gemfile.lock b/Gemfile.lock index 8a2db7917..6df83290c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -391,13 +391,14 @@ GEM rspec-mocks (~> 2.14.0) ruby-oembed (0.8.9) ruby-progressbar (1.5.1) - rubyzip (1.1.0) - safe_yaml (1.0.1) - sass (3.2.14) - sass-rails (4.0.1) + rubyzip (1.1.4) + safe_yaml (1.0.3) + sass (3.2.19) + sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) selenium-webdriver (2.42.0) childprocess (>= 0.5.0) multi_json (~> 1.0) @@ -541,7 +542,7 @@ DEPENDENCIES rspec-instafail (= 0.2.4) rspec-rails (= 2.14.2) ruby-oembed (= 0.8.9) - sass-rails (= 4.0.1) + sass-rails (= 4.0.3) selenium-webdriver (= 2.42.0) sidekiq (= 2.17.7) simple_captcha2 (= 0.2.1) diff --git a/app/assets/stylesheets/default.css b/app/assets/stylesheets/default.css.scss similarity index 100% rename from app/assets/stylesheets/default.css rename to app/assets/stylesheets/default.css.scss diff --git a/app/models/conversation.rb b/app/models/conversation.rb index 2217e2048..112a91f55 100644 --- a/app/models/conversation.rb +++ b/app/models/conversation.rb @@ -68,7 +68,7 @@ class Conversation < ActiveRecord::Base end def receive(user, person) - cnv = Conversation.find_or_create_by(self.attributes) + cnv = Conversation.find_or_create_by!(self.attributes) self.participants.each do |participant| ConversationVisibility.find_or_create_by(conversation_id: cnv.id, person_id: participant.id) diff --git a/app/models/user.rb b/app/models/user.rb index 9693b9ab3..5f7a5fd22 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -480,7 +480,7 @@ class User < ActiveRecord::Base save end end - + private def clearable_fields self.attributes.keys - ["id", "username", "encrypted_password", diff --git a/features/desktop/closes_account.feature b/features/desktop/closes_account.feature index a06e00c9d..22ff9a947 100644 --- a/features/desktop/closes_account.feature +++ b/features/desktop/closes_account.feature @@ -32,5 +32,7 @@ Feature: Close account And I press "close_account_confirm" in the modal window And I confirm the alert Then I sign in as "alice@alice.alice" + #TODO: find out why the automatic login here doesn't work anymore + And I try to sign in manually And I am on the home page Then I should see "Bob Jones" diff --git a/features/desktop/profile_photos.feature b/features/desktop/profile_photos.feature index 8042dfa0c..2d7dc10bc 100644 --- a/features/desktop/profile_photos.feature +++ b/features/desktop/profile_photos.feature @@ -16,6 +16,8 @@ Feature: show photos Scenario: see my own photos When I am on "robert@grimm.grimm"'s page + #TODO: find out why images don't show on first load + And I am on "robert@grimm.grimm"'s page And I follow "View all" within ".image_list" Then I should be on person_photos page diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index 8b8c1933b..5388619cc 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -24,18 +24,18 @@ end Given /^"([^"]*)" has a public post with text "([^"]*)"$/ do |email, text| user = User.find_by_email(email) - user.post(:status_message, :text => text, :public => true, :to => user.aspects) + user.post(:status_message, :text => text, :public => true, :to => user.aspect_ids) end Given /^"([^"]*)" has a non public post with text "([^"]*)"$/ do |email, text| user = User.find_by_email(email) - user.post(:status_message, :text => text, :public => false, :to => user.aspects) + user.post(:status_message, :text => text, :public => false, :to => user.aspect_ids) end And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email| user = User.find_by_email(email) root = Post.find_by_text(text) - user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects) + user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspect_ids) end And /^I submit the publisher$/ do diff --git a/lib/diaspora/taggable.rb b/lib/diaspora/taggable.rb index bbf725532..36bab4d64 100644 --- a/lib/diaspora/taggable.rb +++ b/lib/diaspora/taggable.rb @@ -25,16 +25,10 @@ module Diaspora end def tag_strings - regex = /(?:^|\s)#([#{ActsAsTaggableOn::Tag.tag_text_regexp}]+|<3)/u - matches = self. - send( self.class.field_with_tags ). - scan(regex). - map { |match| match[0] } - unique_matches = matches.inject(Hash.new) do |h,element| - h[element.downcase] = element unless h[element.downcase] - h - end - unique_matches.values + (send(self.class.field_with_tags) || "") + .scan(/(?:^|\s)#([#{ActsAsTaggableOn::Tag.tag_text_regexp}]+|<3)/u) + .map(&:first) + .uniq(&:downcase) end def self.format_tags(text, opts={})