Bring a large pot of water to a boil. Add pasta; cook until just tender, 8 to 10 minutes or according to package directions. Drain and transfer to a large bowl.

Meanwhile, heat oil in a large nonstick skillet over medium heat. Add onion and garlic and cook, stirring, until soft and beginning to brown, about 3 minutes. Add mushrooms, salt and pepper and cook, stirring, until the mushrooms release their liquid, 4 to 6 minutes. Add tomatoes, spinach and crushed red pepper (if using). Increase heat to medium-high; cook, stirring once halfway through, until the spinach is wilted, about 4 minutes. Toss the sauce with the pasta and divide among 4 bowls. Dollop each serving with 3 tablespoons of ricotta.