diff --git a/Gemfile b/Gemfile index 0394f93..db09839 100644 --- a/Gemfile +++ b/Gemfile @@ -81,5 +81,4 @@ group :test do # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] gem 'capybara' gem 'selenium-webdriver' - gem 'rails-controller-testing' end diff --git a/Gemfile.lock b/Gemfile.lock index 744477b..28679b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -237,10 +237,6 @@ GEM activesupport (= 7.1.3.4) bundler (>= 1.15.0) railties (= 7.1.3.4) - rails-controller-testing (1.0.5) - actionpack (>= 5.0.1.rc1) - actionview (>= 5.0.1.rc1) - activesupport (>= 5.0.1.rc1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -396,7 +392,6 @@ DEPENDENCIES mini_magick puma (>= 5.0) rails (~> 7.1.3, >= 7.1.3.4) - rails-controller-testing redis (>= 4.0.1) rspec-rails (~> 6.0.0) selenium-webdriver diff --git a/spec/controllers/analytics_controller_spec.rb b/spec/controllers/analytics_controller_spec.rb index 59204a1..cb1418a 100644 --- a/spec/controllers/analytics_controller_spec.rb +++ b/spec/controllers/analytics_controller_spec.rb @@ -17,15 +17,15 @@ it "assigns the correct instance variables" do get :index - expect(assigns(:total_page_views)).to be_a(Integer) - expect(assigns(:total_link_clicks)).to be_a(Integer) - expect(assigns(:total_achievement_views)).to be_a(Integer) - expect(assigns(:unique_visitors)).to be_a(Integer) - expect(assigns(:latest_daily_metric)).to be_a(DailyMetric) - expect(assigns(:link_analytics)).to be_an(Array) - expect(assigns(:achievement_analytics)).to be_an(Array) - expect(assigns(:daily_views)).to be_a(Hash) - expect(assigns(:browser_data)).to be_a(Hash) + expect(controller.instance_variable_get(:@total_page_views)).to be_a(Integer) + expect(controller.instance_variable_get(:@total_link_clicks)).to be_a(Integer) + expect(controller.instance_variable_get(:@total_achievement_views)).to be_a(Integer) + expect(controller.instance_variable_get(:@unique_visitors)).to be_a(Integer) + expect(controller.instance_variable_get(:@latest_daily_metric)).to be_a(DailyMetric) + expect(controller.instance_variable_get(:@link_analytics)).to be_an(Array) + expect(controller.instance_variable_get(:@achievement_analytics)).to be_an(Array) + expect(controller.instance_variable_get(:@daily_views)).to be_a(Hash) + expect(controller.instance_variable_get(:@browser_data)).to be_a(Hash) end end -end \ No newline at end of file +end diff --git a/spec/controllers/links_controller_spec.rb b/spec/controllers/links_controller_spec.rb index ce4d2e0..ea77088 100644 --- a/spec/controllers/links_controller_spec.rb +++ b/spec/controllers/links_controller_spec.rb @@ -69,10 +69,10 @@ it "assigns the correct instance variables" do get :user_links, params: { username: user.username } - expect(assigns(:user)).to eq(user) - expect(assigns(:links)).to be_an(ActiveRecord::Relation) - expect(assigns(:pinned_links)).to be_an(ActiveRecord::Relation) - expect(assigns(:achievements)).to be_an(ActiveRecord::Relation) + expect(controller.instance_variable_get(:@user)).to eq(user) + expect(controller.instance_variable_get(:@links)).to be_an(ActiveRecord::Relation) + expect(controller.instance_variable_get(:@pinned_links)).to be_an(ActiveRecord::Relation) + expect(controller.instance_variable_get(:@achievements)).to be_an(ActiveRecord::Relation) end end @@ -88,4 +88,4 @@ expect(response).to redirect_to(link.url) end end -end \ No newline at end of file +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 92ab311..8475cee 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -7,7 +7,6 @@ require 'devise' require 'factory_bot_rails' require 'capybara/rspec' -require 'rails-controller-testing' Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f } @@ -26,12 +25,6 @@ config.include Devise::Test::IntegrationHelpers, type: :request config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view - - [:controller, :view, :request].each do |type| - config.include ::Rails::Controller::Testing::TestProcess, :type => type - config.include ::Rails::Controller::Testing::TemplateAssertions, :type => type - config.include ::Rails::Controller::Testing::Integration, :type => type - end config.include FactoryBot::Syntax::Methods @@ -63,4 +56,4 @@ Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end -Capybara.javascript_driver = :chrome_headless \ No newline at end of file +Capybara.javascript_driver = :chrome_headless