Class: HyperSpec::Lolex
- Inherits:
-
Object
- Object
- HyperSpec::Lolex
- Defined in:
- lib/hyper-spec/lolex.rb
Class Method Summary collapse
- .init(page, client_time_zone, resolution) ⇒ Object
- .initialized? ⇒ Boolean
- .pop ⇒ Object
- .push(mock_type, *args) ⇒ Object
- .restore ⇒ Object
- .unmock ⇒ Object
Class Method Details
.init(page, client_time_zone, resolution) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/hyper-spec/lolex.rb', line 4 def init(page, client_time_zone, resolution) = page @resolution = resolution || 10 @client_time_zone = client_time_zone run_pending_evaluations @initialized = true end |
.initialized? ⇒ Boolean
12 13 14 |
# File 'lib/hyper-spec/lolex.rb', line 12 def initialized? @initialized end |
.pop ⇒ Object
29 30 31 |
# File 'lib/hyper-spec/lolex.rb', line 29 def pop evaluate_ruby { 'Lolex.pop' } end |
.push(mock_type, *args) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hyper-spec/lolex.rb', line 16 def push(mock_type, *args) scale = if mock_type == :freeze 0 elsif mock_type == :scale args[0] else 1 end evaluate_ruby do "Lolex.push('#{time_string_in_zone}', #{scale}, #{@resolution})" end end |
.restore ⇒ Object
37 38 39 |
# File 'lib/hyper-spec/lolex.rb', line 37 def restore evaluate_ruby { 'Lolex.restore' } end |
.unmock ⇒ Object
33 34 35 |
# File 'lib/hyper-spec/lolex.rb', line 33 def unmock evaluate_ruby { "Lolex.unmock('#{time_string_in_zone}', #{@resolution})" } end |