
615 A.2d 122 (1992)
WORLD-WIDE COMPUTER RESOURCES, INC.
v.
ARTHUR KAUFMAN SALES CO. et al.
No. 91-673-Appeal.
Supreme Court of Rhode Island.
October 30, 1992.
*123 Barry J. Kusinitz, Corrente, Brill & Kusinitz, Providence, for plaintiff.
Richard O. Lessard, Rodio & Ursillo, Ltd., Providence, for defendants.

OPINION
WEISBERGER, Justice.
This case comes before us on appeals from both parties from orders entered by a justice of the Superior Court during the trial of an action on book account filed by the plaintiff and a counterclaim filed by the defendants. The trial justice dismissed the plaintiff's complaint without prejudice for lack of capacity to sue pursuant to the provisions of G.L. 1956 (1985 Reenactment) § 7-1.1-117. The trial justice directed a verdict against the defendants on their counterclaim and rendered judgment accordingly. We vacate the judgment and remand for a new trial. The facts of the case insofar as pertinent to these appeals are as follows.
Jonathan Springer, president of World-Wide Computer Resources, Inc. (World-Wide or plaintiff) entered into an agreement with Arthur Kaufman Sales Co., Multi-Source International, Ltd., and Disposable Products Co. (the Kaufman companies or defendants) to provide a software system as part of a computer package for use in the business of the Kaufman companies. Generally, the Kaufman companies served as manufacturers' representatives. They dealt in disposable coffee lids, party goods, napkins, straws, plates, and cups. They would accept orders from customers then submit each order to a manufacturer who would produce the product and ship it directly to the customer. The Kaufman companies would receive a commission on the sale. In certain instances, some of the Kaufman companies purchased goods from suppliers and stored them in their warehouses. The Kaufman companies engaged World-Wide through its president, Jonathan Springer (Springer), to prepare a computer-software system with the appropriate hardware to handle the processing of orders and inventory for the three Kaufman companies. Springer worked from January 1985 until sometime in 1986, when he and the Kaufman companies terminated the relationship. Springer then filed a complaint in the Superior Court claiming that at that time he was owed an arrearage of payments of $31,140.25. In their counterclaim, the Kaufman companies asserted that they never received a functional operating computer package. They claimed that the computer systems installed by Springer did not work properly and did not perform the functions contemplated in the contract.
During the course of the trial, counsel for the Kaufman companies elicited on cross-examination that World-Wide had never obtained a certificate of authority to do business in Rhode Island as required by § 7-1.1-117. It was further elicited on cross-examination that World-Wide had been dissolved as a corporate entity in Massachusetts as of December 31, 1990. At that juncture, defendants sought to amend their answer in order to raise the defense of lack of capacity. The trial justice permitted this amendment and then dismissed plaintiff's complaint without prejudice for lack of capacity to maintain its action.
After the close of the evidence in the case, the trial justice considered a motion for directed verdict filed by plaintiff against defendants in respect to their counterclaim. The trial justice granted the motion for directed verdict on the ground that there was no evidence that plaintiff had *124 breached its agreement and further that there was no evidence that defendants had incurred expenses as a result of World-Wide's failure to perform. We shall consider the two issues in the case as they have been raised by the parties.

I

The Dismissal of Plaintiff's Action
It is undisputed that World-Wide was a Massachusetts corporation. This fact was set forth in its complaint, which was filed November 24, 1986. It is further undisputed that Springer, on behalf of World-Wide, was engaged in the conduct of business at the premises of the Kaufman companies located in the State of Rhode Island. The statute, § 7-1.1-117, upon which the Kaufman companies relied in their defense to the action, reads as follows in pertinent part:
"Transacting business without certificate of authority.  (a) No foreign corporation transacting business in this state without a certificate of authority shall be permitted to maintain any action, suit or proceeding in any court of this state, until such corporation shall have obtained a certificate of authority. Nor shall any action, suit or proceeding be maintained in any court of this state by any successor or assignee of such corporation on any right, claim or demand arising out of the transaction of business by such corporation in this state, until a certificate of authority shall have been obtained by such corporation or by a corporation which has acquired all or substantially all of its assets.
(b) The failure of a foreign corporation to obtain a certificate [of] authority to transact business in this state shall not impair the validity of any contract or act of such corporation, and shall not prevent such corporation from defending any action, suit or proceeding in any court of this state."
The Supreme Court of Rhode Island has interpreted this statute to require that an out-of-state corporation that brings action against a Rhode Island defendant based upon a contract performed within this state must obtain a certificate of authority before proceeding to final judgment. Tiffany Agency of Modeling, Inc. v. Butler, 110 R.I. 568, 295 A.2d 47 (1972); New England Dye Co. v. General Products Co., 92 R.I. 292, 168 A.2d 150 (1961). The court in Tiffany went on to observe that if a defendant desired to raise such an issue, it would be required to file a responsive pleading challenging the plaintiff corporation's capacity to maintain the action. 110 R.I. at 573, 295 A.2d at 50. In the event that a defendant should prevail on the issue of alleged incapacity, the out-of-state corporation would be entitled to acquire standing by obtaining a certificate of authority during the course of the trial. Good Will Home Ass'n v. Drayton, 108 R.I. 277, 274 A.2d 750 (1971); see 1 Kent, R.I. Civ. Prac. § 17.5 at 167 (1969).
In the case at bar, this issue was raised for the first time during the month of July 1991 after the case had been pending for more than four years. We have held that the failure to raise an affirmative defense in a timely manner constitutes a waiver of that defense. See LaBounty v. LaBounty, 497 A.2d 302, 305 (R.I. 1985); Duquette v. Godbout, 416 A.2d 669, 670 (R.I. 1980). We further observed that the special pleading of an affirmative defense protects the complaining party from unfair surprise at trial. This doctrine in interpretation of Rule 8(c) of the Superior Court Rules of Civil Procedure may be in apparent conflict with Rule 15, which permits a party to amend pleadings. It must be noted that we have also held that amendments to pleadings are to be allowed with great liberality absent a showing of extreme prejudice. Mikaelian v. Drug Abuse Unit, 501 A.2d 721, 722 (R.I. 1985); Kuczer v. City of Woonsocket, 472 A.2d 300, 301 (R.I. 1984). In resolving such a conflict, we must necessarily take into account such elements as the extent of prejudice, as well as the question of a defendant's knowledge of circumstances that should have alerted him or her to the existence of such a defense.
*125 On the issue of prejudice, this plaintiff was placed in a most difficult situation when this defense was raised for the first time in the course of trial. Had the defense been raised in the answer immediately following the filing of the complaint, when World-Wide was a validly existing corporation in the Commonwealth of Massachusetts, it could have obtained a certificate of authority with very little difficulty in the State of Rhode Island well before trial had commenced. However, when this defense was raised, World-Wide was no longer a validly existing corporation in Massachusetts and therefore could not readily obtain a certificate of authority in Rhode Island, without reestablishing its existence in Massachusetts. The efforts to revitalize the corporation and obtain a certificate of authority could not reasonably be accomplished within the time remaining for the trial of the case.[1]
On the issue of the defendants' knowledge of facts that should have alerted them to the raising of this defense, there is no question that defendants knew from the beginning that World-Wide was a Massachusetts corporation. Although the pleadings did not alert the Kaufman companies to World-Wide's failure to obtain a certificate of authority, a call to the office of the Secretary of State would have disclosed this fact promptly and without difficulty. Thus we can see no reason why defendants should have been allowed to raise this defense during the course of the trial to the extreme prejudice of plaintiff when it could have been raised seasonably many years before.
Consequently we are of the opinion that the trial justice erred in allowing defendants to amend their answer during the trial of the case to raise lack of capacity to maintain the action.

II

The Directed Verdict
In deciding the motion for directed verdict, the trial justice indicated his awareness of our numerous cases that establish the standard to be applied to such a motion. We have frequently stated that in order to grant a motion for a directed verdict, the trial justice should view the evidence in the light most favorable to the party who opposes the motion and should draw all reasonable favorable inferences from such evidence without considering the weight of the evidence or the credibility of the witnesses. After having applied this test to the evidence, the trial justice may grant the motion only if he or she finds that the posture of the evidence so viewed raises no question of fact upon which reasonable persons might differ. See, e.g., Brenner Associates, Inc. v. Rousseau, 537 A.2d 120, 123 (R.I. 1988); Solitro v. Moffatt, 523 A.2d 858, 861 (R.I. 1987); Marcotte v. Harrison, 443 A.2d 1225, 1229 (R.I. 1982).
In applying this standard to the evidence in this case, as disclosed by the record, we are of the opinion that factual issues were raised concerning whether the computer package supplied by World-Wide was in accordance with the defendants' reasonable expectation that a functioning and workable system would be installed. It is true that at the time that Springer ceased his efforts, the system had not been completed. However, there is still a factual issue concerning whether his efforts had met the standards implied by the agreement that the skill and effectiveness to be applied by Springer, on behalf of World-Wide, would make the product reasonably fit for the intended use of the computer package. There was a great deal of evidence presented concerning the fact that the systems were not functioning at the time that Springer had terminated for failure of further payment. We believe that there is, nevertheless, a factual issue concerning whether these computer packages installed *126 for the three companies had reached a stage of development and effectiveness that would have required the Kaufman companies to allow Springer to complete the job and pay World-Wide for his continuing performance. Although the trial justice expressed the opinion that the purported expert testimony was inadequate, we believe there was sufficient evidence presented to create factual issues for the jury. Consequently we hold that the trial justice was in error in directing a verdict against the defendants on their counterclaim.
For the reasons stated, the judgment dismissing the plaintiff's action for lack of capacity is vacated; the judgment entered on the directed verdict on the defendants' counterclaim is also vacated. The papers in the case may be remanded to the Superior Court for further proceedings.
NOTES
[1]  No issue has been raised in the Superior Court concerning the capacity of a dissolved corporation to maintain an action brought prior to the dissolution. Consequently, we do not preclude the defendants from raising such an issue on remand in the event that World-Wide has not been reinstated as a validly existing corporation when this case is returned to the Superior Court for further proceedings. This issue is distinct from the question respecting whether a foreign corporation may maintain an action when not authorized to do business in this state in accordance with G.L. 1956 (1985 Reenactment) § 7-1.1-117.
