Tags » Rspec 2

RSpect : need to be taken care of while writing UnitTesting

Ok let me show an example

let(:role) { create :role, name: 'parent' }
let(:user) { create(:user1, roles: ) }
let(:pact) { create :pact, parent_id: user.id, renews_at: 1.hour.ago }
let(:execution){ AutoRenewalPactAsync.new.perform}

it 'should renew pact and also schedule the drug test whose renews_at date is today' do
  expect{execution}.to change{pact.pact_years.count}.by(1)
  expect(pact.renews_at).to eq(pact.renews_at + Pact::RenewalYear)
Failure/Error: expect(pact.renews_at).to eq(1.year.from_now)
 expected: 2017-02-28 09:20:41.204897017 +0000
 got: 2016-02-28 08:20:40.980794147 +0000

… 170 more words
Rubu On Rails

How to mock Stripe::Charge.retrieve using Stripe Mock gem

I created customer, made a subscription on the behalf of the customer. Along with that I generated invoices and expected in the RSpec example like… 76 more words

Ruby On Rails