From 56b64d70bdfada888fc020398ad22a491df95558 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 14:40:42 +0530 Subject: [PATCH 1/9] rspec fixes --- config/application.rb | 7 +++++++ spec/features/users/banned_spec.rb | 16 +++++++++------- spec/features/users/inbox_spec.rb | 4 ++-- spec/models/comment_smile_spec.rb | 5 ----- spec/models/subscription_spec.rb | 5 ----- 5 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 spec/models/comment_smile_spec.rb delete mode 100644 spec/models/subscription_spec.rb diff --git a/config/application.rb b/config/application.rb index ae991ac9..4f627bb4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,5 +23,12 @@ module Justask # Use Sidekiq for background jobs config.active_job.queue_adapter = :sidekiq + + # DEPRECATION WARNING: Currently, Active Record suppresses errors raised + # within `after_rollback`/`after_commit` callbacks and only print them to the logs. + # In the next version, these errors will no longer be suppressed. + # Instead, the errors will propagate normally just like in other Active Record callbacks. + # fix for this warning: + config.active_record.raise_in_transactional_callbacks = true end end diff --git a/spec/features/users/banned_spec.rb b/spec/features/users/banned_spec.rb index 6b4f4107..399eb5da 100644 --- a/spec/features/users/banned_spec.rb +++ b/spec/features/users/banned_spec.rb @@ -22,22 +22,24 @@ feature "Ban users", :devise do login_as me, scope: :user visit root_path expect(page).to have_text("Timeline") - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_1.png"), full: true + page.driver.render Rails.root.join("tmp/ban_#{Time.now.to_i}_1.png"), full: true - me.banned = true + me.permanently_banned = true me.save - click_link "Inbox" + + visit "/inbox" + expect(current_path).to eq(new_user_session_path) - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true + page.driver.render Rails.root.join("tmp/ban_#{Time.now.to_i}_2.png"), full: true end scenario 'user visits banned user profiles', js: true do evil_user = FactoryGirl.create :user - evil_user.banned = true + evil_user.permanently_banned = true evil_user.save visit show_user_profile_path(evil_user.screen_name) - expect(page).to have_text('Banned'.upcase) - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true + expect(page).to have_text('BANNED') + page.driver.render Rails.root.join("tmp/ban_#{Time.now.to_i}_3.png"), full: true end end diff --git a/spec/features/users/inbox_spec.rb b/spec/features/users/inbox_spec.rb index 9b9a99ed..84844425 100644 --- a/spec/features/users/inbox_spec.rb +++ b/spec/features/users/inbox_spec.rb @@ -56,7 +56,7 @@ feature "Inbox", :devise do click_button "Get new question" wait_for_ajax - expect(page).to have_text('Answer'.upcase) + expect(page).to have_text('Answer') page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true end @@ -77,7 +77,7 @@ feature "Inbox", :devise do click_button "Get new question" wait_for_ajax - expect(page).to have_text('Answer'.upcase) + expect(page).to have_text('Answer') page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true end diff --git a/spec/models/comment_smile_spec.rb b/spec/models/comment_smile_spec.rb deleted file mode 100644 index 43e4d9f6..00000000 --- a/spec/models/comment_smile_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe CommentSmile, :type => :model do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/models/subscription_spec.rb b/spec/models/subscription_spec.rb deleted file mode 100644 index 2c8d59e9..00000000 --- a/spec/models/subscription_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe Subscription, :type => :model do - pending "add some examples to (or delete) #{__FILE__}" -end From bda777fe2df53825a7d53b19e8a7ac4ce7134598 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 14:57:37 +0530 Subject: [PATCH 2/9] Hopefully this fixes the last error in travis, doesn't error on my end --- spec/features/users/inbox_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/users/inbox_spec.rb b/spec/features/users/inbox_spec.rb index 84844425..565d7be5 100644 --- a/spec/features/users/inbox_spec.rb +++ b/spec/features/users/inbox_spec.rb @@ -34,7 +34,7 @@ feature "Inbox", :devise do click_button "Answer" wait_for_ajax - expect(page).not_to have_text(question.content) + expect(page).not_to have_text(question.content, wait: 2) page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true visit show_user_profile_path(me.screen_name) From eee53e8f6e7f3839d2f477d72410e512e4975845 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 15:20:20 +0530 Subject: [PATCH 3/9] WHAT IS MAKING THIS ERROR WTF --- spec/features/users/inbox_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/features/users/inbox_spec.rb b/spec/features/users/inbox_spec.rb index 565d7be5..9df06407 100644 --- a/spec/features/users/inbox_spec.rb +++ b/spec/features/users/inbox_spec.rb @@ -25,21 +25,21 @@ feature "Inbox", :devise do login_as me, scope: :user visit root_path expect(page).to have_text('1 new question'.upcase) - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_1.png"), full: true + page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_1.png"), full: true click_link "Inbox" - expect(page).to have_text(question.content) - fill_in "ib-answer", with: Faker::Lorem.sentence - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true + expect(page).to have_text(question.content, wait: 2) + fill_in "ib-answer", with: "This is an answer. I'm number i!" + page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_2.png"), full: true click_button "Answer" wait_for_ajax - expect(page).not_to have_text(question.content, wait: 2) - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true + expect(page).to have_text("Successfully answered question.", wait: 2) + page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_3.png"), full: true visit show_user_profile_path(me.screen_name) expect(page).to have_text(question.content) - page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_4.png"), full: true + page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_4.png"), full: true end # Scenario: User generates new question From fa1ef1de21a6d262fcfe38c30399c857bd979a0a Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 15:34:08 +0530 Subject: [PATCH 4/9] this probably is it, if it's not then it's your problem, i didn't cause this --- config/justask.yml.example | 4 ++-- spec/features/users/inbox_spec.rb | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/justask.yml.example b/config/justask.yml.example index 725b5c16..f7669a9a 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -15,14 +15,14 @@ items_per_page: 10 # OAuth tokens sharing: twitter: - enabled: true + enabled: false # Get the tokens from https://apps.twitter.com consumer_key: '' consumer_secret: '' facebook: enabled: false tumblr: - enabled: true + enabled: false # Get the tokens from https://www.tumblr.com/oauth/apps consumer_key: '' consumer_secret: '' diff --git a/spec/features/users/inbox_spec.rb b/spec/features/users/inbox_spec.rb index 9df06407..7af88527 100644 --- a/spec/features/users/inbox_spec.rb +++ b/spec/features/users/inbox_spec.rb @@ -28,13 +28,14 @@ feature "Inbox", :devise do page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_1.png"), full: true click_link "Inbox" - expect(page).to have_text(question.content, wait: 2) + expect(page).to have_text(question.content) + expect(page).to have_field('ib-answer', wait: 2) fill_in "ib-answer", with: "This is an answer. I'm number i!" page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_2.png"), full: true click_button "Answer" wait_for_ajax - expect(page).to have_text("Successfully answered question.", wait: 2) + expect(page).not_to have_text(question.content, wait: 2) page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_3.png"), full: true visit show_user_profile_path(me.screen_name) From d81c11c0e6a708514d188f4a33de63c9745b0e5c Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 15:50:01 +0530 Subject: [PATCH 5/9] what's the internal server error --- config/environments/test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index 0d6459df..9db52e64 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -21,7 +21,7 @@ Rails.application.configure do config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + config.action_dispatch.show_exceptions = true # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false From b543c356653341ce9864f64760b14f6369ccbcbc Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 16:02:29 +0530 Subject: [PATCH 6/9] i wonder if this is the issue --- .travis.yml | 4 ++-- config/environments/test.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f98925d..61e02f3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby -rvm: 2.1 +rvm: 2.0.0 before_script: - cp config/database.yml.postgres config/database.yml - cp config/justask.yml.example config/justask.yml - bundle exec rake db:setup - - bundle exec rake db:migrate \ No newline at end of file + - bundle exec rake db:migrate diff --git a/config/environments/test.rb b/config/environments/test.rb index 9db52e64..0d6459df 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -21,7 +21,7 @@ Rails.application.configure do config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = true + config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false From 3d2b884b740311077dd4601c855a8c7231bf4232 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 16:09:12 +0530 Subject: [PATCH 7/9] Revert to 'rspec fixes' -- 'Inbox user answers a question' is a mysterious failure --- .travis.yml | 4 ++-- config/justask.yml.example | 4 ++-- spec/features/users/inbox_spec.rb | 13 ++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 61e02f3c..3f98925d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby -rvm: 2.0.0 +rvm: 2.1 before_script: - cp config/database.yml.postgres config/database.yml - cp config/justask.yml.example config/justask.yml - bundle exec rake db:setup - - bundle exec rake db:migrate + - bundle exec rake db:migrate \ No newline at end of file diff --git a/config/justask.yml.example b/config/justask.yml.example index f7669a9a..725b5c16 100644 --- a/config/justask.yml.example +++ b/config/justask.yml.example @@ -15,14 +15,14 @@ items_per_page: 10 # OAuth tokens sharing: twitter: - enabled: false + enabled: true # Get the tokens from https://apps.twitter.com consumer_key: '' consumer_secret: '' facebook: enabled: false tumblr: - enabled: false + enabled: true # Get the tokens from https://www.tumblr.com/oauth/apps consumer_key: '' consumer_secret: '' diff --git a/spec/features/users/inbox_spec.rb b/spec/features/users/inbox_spec.rb index 7af88527..84844425 100644 --- a/spec/features/users/inbox_spec.rb +++ b/spec/features/users/inbox_spec.rb @@ -25,22 +25,21 @@ feature "Inbox", :devise do login_as me, scope: :user visit root_path expect(page).to have_text('1 new question'.upcase) - page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_1.png"), full: true + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_1.png"), full: true click_link "Inbox" expect(page).to have_text(question.content) - expect(page).to have_field('ib-answer', wait: 2) - fill_in "ib-answer", with: "This is an answer. I'm number i!" - page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_2.png"), full: true + fill_in "ib-answer", with: Faker::Lorem.sentence + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_2.png"), full: true click_button "Answer" wait_for_ajax - expect(page).not_to have_text(question.content, wait: 2) - page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_3.png"), full: true + expect(page).not_to have_text(question.content) + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_3.png"), full: true visit show_user_profile_path(me.screen_name) expect(page).to have_text(question.content) - page.driver.render Rails.root.join("tmp/answer_#{Time.now.to_i}_4.png"), full: true + page.driver.render Rails.root.join("tmp/#{Time.now.to_i}_4.png"), full: true end # Scenario: User generates new question From b556024454172619161db0b1d47e3d62acecc8e9 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 16:33:52 +0530 Subject: [PATCH 8/9] travis env remake --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3f98925d..f3ab4715 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,4 @@ rvm: 2.1 before_script: - cp config/database.yml.postgres config/database.yml - cp config/justask.yml.example config/justask.yml - - bundle exec rake db:setup - - bundle exec rake db:migrate \ No newline at end of file + - bundle exec rake db:drop db:create db:migrate db:test:prepare From 5325951106952bc154fd66875b33c9c2034854f5 Mon Sep 17 00:00:00 2001 From: pixeldesu Date: Mon, 11 May 2015 15:11:14 +0200 Subject: [PATCH 9/9] update README to use Snap CI instead of Travis CI --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e403f3f..4a4ca042 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Retrospring [![Build Status](https://travis-ci.org/Retrospring/retrospring.svg?branch=master)](https://travis-ci.org/Retrospring/retrospring) +# Retrospring [![Build Status](https://snap-ci.com/Retrospring/retrospring/branch/master/build_image)](https://snap-ci.com/Retrospring/retrospring/branch/master) This is the source code that powers Retrospring. Yep, all of it. Including all the branches where we left off.