Rishabh Malhotra
Rishabh Malhotra

Reputation: 25

StatementInvalid: SQLite3::BusyException: database is locked

I have referred various answers on StackOverflow but I still haven't been able to resolve this issue. I am sharing the code for my controllers_test.rb and along with that the screenshot. Every time I run rails test, the following error is shown. I have made sure that console is close. In case there is any other source code needs to be share please do let me know.

require "test_helper"

class CategoriesControllerTest < ActionDispatch::IntegrationTest
 setup do
  @category = Category.create(name: "Sports")
 end

 test "should get index" do
  get categories_url
  assert_response :success
 end

 test "should get new" do
  get new_category_url
  assert_response :success
 end

 test "should create category" do
  assert_difference('Category.count') do
   post categories_url, params: { category: { name: "Travel" } }
  end
  assert_redirected_to category_url(Category.last)
 end

 test "should show category" do
  get category_url(@category)
  assert_response :success
 end
end

enter image description here

test_helper.rb

class ActiveSupport::TestCase 
  # Run tests in parallel with specified workers
  parallelize(workers: :number_of_processors, with: :threads) 
  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 
  fixtures :all 
  # Add more helper methods to be used by all tests here...
end

Upvotes: 0

Views: 103

Answers (0)

Related Questions