Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load up test events by reading file #1

Open
kevin-j-m opened this issue Nov 1, 2015 · 3 comments
Open

Load up test events by reading file #1

kevin-j-m opened this issue Nov 1, 2015 · 3 comments

Comments

@kevin-j-m
Copy link
Owner

Rather than overloading the every and configure method call in Clockwork itself, Clockwork::Test#run should parse the file itself to hand off events to Clockwork::Test::Manager to register.

@atomaka
Copy link

atomaka commented Sep 28, 2016

Note that the current method causes an issue with simplecov's line coverage counting. When a file is reloaded, the line counts are all reset.

If anyone else is looking for a work around, I've temporarily solved this by starting my clockwork test runner in a before(:all) instead of a before(:each):

before(:all) do
  start = Time.new(2018, 1, 1, 23, 0, 0)
  Clockwork::Test.run(file: "./app/schedule.rb", start_time: start, end_time: start + 1.day, tick_speed: 1.minute)
end
after(:all) { Clockwork::Test.clear! }

It leads to your tests not being isolated, so be careful.

@kevin-j-m
Copy link
Owner Author

Thanks for posting this workaround @atomaka. I apologize that this causes issues for you with simplecov.

To be honest, I'm not sure when I'll be able to devote time to update this, but I appreciate your message.

PRs are welcome if anyone wants to take a crack at it!

@kevin-j-m
Copy link
Owner Author

See another issue related to this in #30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants