timecop icon indicating copy to clipboard operation
timecop copied to clipboard

Proposal: Usage with RSpec metadata

Open maurogeorge opened this issue 10 years ago • 1 comments

The VCR uses a API that is possible move the block syntax to a RSpec metadata.

This

it 'my spec' do
  VCR.use_cassette('synopsis') do
    # code here
  end
end

became

it 'my spec', vcr: { cassette_name: 'synopsis' } do
  # code here
end

I guess it is possible make this on timecop, sorry never worked on this codebase.

We can have something like:

it 'my spec', timecop: { mode: :freeze, time: Time.local(1990) } do
  # code here
end

And on the mode we can pass :freeze, :travel and :scale.

Do you guys think that makes sense?

maurogeorge avatar Mar 07 '14 19:03 maurogeorge

I make a PR #119 showing my idea. I hope you guys like

maurogeorge avatar Mar 15 '14 15:03 maurogeorge