Giter Club home page Giter Club logo

cucumber-timecop's Introduction

cucumber-timecop's People

Contributors

edejong avatar v0dro avatar zedtux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

v0dro jewilmeer

cucumber-timecop's Issues

Error without Rais / Active Support

Hello,

I am getting this failure:

    And time is frozen at now                                                                                            # cucumber-timecop-0.0.5/lib/cucumber/timecop.rb:40
      undefined method `now' for "BRT":String (NoMethodError)
      /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic/parser.rb:54:in `initialize'
      /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic.rb:90:in `new'
      /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic.rb:90:in `parse'
      /home/fornellas/local/gems/22/gems/cucumber-timecop-0.0.5/lib/cucumber/timecop.rb:30:in `parse_time'
      /home/fornellas/local/gems/22/gems/cucumber-timecop-0.0.5/lib/cucumber/timecop.rb:24:in `freeze_time_at'
      /home/fornellas/local/gems/22/gems/cucumber-timecop-0.0.5/lib/cucumber/timecop.rb:41:in `block in <top (required)>'

It seems like, here is the cause:
https://github.com/zedtux/cucumber-timecop/blob/master/lib/cucumber/timecop.rb#L50
It sets Chronic.time_class to Time.now.zone in my case (no Rails). It tries to do something like:
https://github.com/mojombo/chronic/blob/master/lib/chronic.rb#L47
but it does not work:

irb(main):002:0> Chronic.time_class
=> Time
irb(main):003:0> Chronic.parse 'now'
=> 2015-10-13 12:33:55 -0300
irb(main):004:0> Chronic.time_class = Time.now.zone
=> "BRT"
irb(main):005:0> Chronic.parse 'now'
NoMethodError: undefined method `now' for "BRT":String
    from /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic/parser.rb:54:in `initialize'
    from /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic.rb:90:in `new'
    from /home/fornellas/local/gems/22/gems/chronic-0.10.2/lib/chronic.rb:90:in `parse'
    from (irb):5
    from /opt/ruby22/bin/irb:11:in `<main>'

I guess the appropriate fix, for no Rails would be to maintain Chronic's original value:
https://github.com/mojombo/chronic/blob/master/lib/chronic.rb#L80
with:
Chronic.time_class = defined?(Rails) ? Time.zone : ::Time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.