From 56b64d70bdfada888fc020398ad22a491df95558 Mon Sep 17 00:00:00 2001 From: Yuki Date: Mon, 11 May 2015 14:40:42 +0530 Subject: [PATCH] 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