Heat the oil in a frypan over medium heat and cook the onion and garlic until tender. Mix in mushrooms, green capsicum and tomatoes. Season with rosemary, salt and pepper. Stir in tomato paste and beef stock. Reduce heat to low, cover and simmer 15 minutes.
Bring a large pot of lightly salted water to a boil. Add spaghetti and cook for 8 to 10 minutes or until al dente; drain.
Mix the flour into the sauce to thicken. Serve sauce over the cooked pasta.