samedi 2 juillet 2016

Rspec expect not working and getting success

I wrote the following code:

require_relative '../ticket'
describe Ticket do
  before do
    @ticket = Ticket.new()
  end
# context "check_ticket" do
#   it 'check_a_ticket' do
#     @ticket.stub(:gets) {"quit"}
#     expect(@ticket.show_tickets(1)).to be_present
#   end
# end
# context "check_tickets" do
#   it 'check_tickets' do
#     t@icket.stub(:gets) {"menu"}
#     expect(@ticket.ticket_viewer(1)).to be_present
#   end
# end
  context "exit" do
    it 'check_exit' do
      result = @ticket.ticket_viewer("quit")
      expect(result).to include("Thanks")
    end
  end
end

When I try to execute,

expect(result).to eq("something")

does not work. The case is passed no matter what the value is in eg("something"). Help please.

Aucun commentaire:

Enregistrer un commentaire