Skip to content

Conversation

@bittrance
Copy link
Owner

There are several operators which take a Time argument and act at a point in time. This PR introduce the somewhat hacky TestTime which === Time and can therefore be used to signify an absolute point in "testing time". This means we can write marble-style virtual time tests for these operators and need not resort to async tests. For example:

actual = scheduler.configure do
  Rx::Observable.timer(Rx::TestTime.new(300), scheduler)
end
assert_msgs msgs('---(0|)'), actual 

This unearthed a bug where the alias_method directive (now removed) in VirtualTimeScheduler meant that invokation of schedule_at_absolute_with_state would bypass the TestScheduler and invoke VirtualTimeScheduler. Rather than try to correct this, the PR cleans up the naming of scheduler methods so as to make the alias unnecessary.

Bittrance and others added 2 commits March 30, 2018 00:04
…ives removed. This is because the alias_method directives do not work as the implementation expected: various tests bypassed TestScheduler and directly executed VirtualTimeScheduler#schedule_at_absolute_with_state.
@bittrance bittrance added this to the 0.1.0 milestone Mar 29, 2018
@bittrance bittrance self-assigned this Mar 29, 2018
@bittrance
Copy link
Owner Author

This borked on JRuby with https://travis-ci.org/bittrance/rxruby/jobs/360064690

ArgumentError: wrong number of arguments (0 for 2)
	from (irb):5:in `initialize'
	from org/jruby/RubyTime.java:1252:in `new'
	from (irb):5:in `<eval>'
	from org/jruby/RubyKernel.java:994:in `eval'
	from org/jruby/RubyKernel.java:1292:in `loop'
	from org/jruby/RubyKernel.java:1114:in `catch'
	from org/jruby/RubyKernel.java:1114:in `catch'
	from .rbenv/versions/jruby-9.1.13.0/bin/irb:13:in `<main>'

which I reported as jruby/jruby#5125.

@bittrance bittrance modified the milestones: 0.1.0, 0.5.0 Mar 30, 2018
…h fails tests that try to subclass Time class
@codecov-io
Copy link

codecov-io commented May 4, 2018

Codecov Report

Merging #63 into master will decrease coverage by 0.19%.
The diff coverage is 97.36%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #63     +/-   ##
=========================================
- Coverage   99.58%   99.38%   -0.2%     
=========================================
  Files          76       77      +1     
  Lines        4526     4518      -8     
=========================================
- Hits         4507     4490     -17     
- Misses         19       28      +9
Impacted Files Coverage Δ
lib/rx/testing/hot_observable.rb 100% <100%> (ø) ⬆️
lib/rx/concurrency/virtual_time_scheduler.rb 99.17% <100%> (-0.04%) ⬇️
lib/rx/testing/test_scheduler.rb 100% <100%> (ø) ⬆️
lib/rx/testing/cold_observable.rb 100% <100%> (ø) ⬆️
lib/rx/testing/test_time.rb 95.23% <95.23%> (ø)
lib/rx/testing/async_testing.rb 92% <0%> (-4%) ⬇️
lib/rx/core/observable.rb 96.96% <0%> (-3.04%) ⬇️
lib/rx/linq/observable/delay_with_selector.rb 98.03% <0%> (-1.97%) ⬇️
lib/rx/operators/creation.rb 98.71% <0%> (-1.29%) ⬇️
lib/rx/operators/standard_query_operators.rb 99.53% <0%> (-0.47%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 70d7c94...904076f. Read the comment docs.

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

Successfully merging this pull request may close these issues.

3 participants