rspec-time_stop 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 64881d08eb4a1d783311c7b755d63ec40f5a37ead0bb566ef0dc85428b349470
4
+ data.tar.gz: 36f3ac8390926784b392efc996ffd972fc758ce91e1a094b93d85d4ec28caa42
5
+ SHA512:
6
+ metadata.gz: f87ffbffd02431e78e813bed2c023cf882405b375a90c2d83f2657d4142a757ccc25d53c26c567d07fa8f71524cb79a8f0f4e351c5eefeb30a4d3f405a709612
7
+ data.tar.gz: 2c96caef7c1ddeaedc2c9eeb658644c8ca699a17d6b22fb8f647a691a3153080fb276a25c14a9c84c7abdc7129079bdb6ac8b83a501ea5674bd8338549d0824e
@@ -0,0 +1 @@
1
+ repo_token: 0OsYZypJzD0ULzwSKNctOf2kgJLq33lFv
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,28 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3
4
+ - 2.4
5
+ - 2.5
6
+ - ruby-head
7
+ bundler_args: "--jobs=4"
8
+ cache: bundler
9
+ before_install:
10
+ - gem update --system --no-document
11
+ - gem install bundler --no-document
12
+ before_script:
13
+ - export CODECLIMATE_REPO_TOKEN=8ea5579e9642757116d044f4abdbfb90393ad21ebfb894170f4daaaedf7f7caf
14
+ - export CI=true
15
+ script:
16
+ - bundle exec rspec
17
+ - bundle exec codeclimate-test-reporter || true
18
+ branches:
19
+ only:
20
+ - master
21
+ notifications:
22
+ email: false
23
+ slack:
24
+ secure: UTyW7J03ev+wlSOP0TNiPF7ztdCSSi0ZqP7g1+x+qfZ7nNVdr3CGLosyVt+fopoHPWbiE5vW0swCMvNDFVD3wFh6ivBg6KsKi+G0FEwWwbgXP2JOzW964vGLpU1t47ErEUh4Hkf5qBRIu2IPumoopOhlGysOA0/qpBQ7F5bPTDHk2/yEY5JglFyqG+ArbsD96pcoCwhn4exDPE5WHWqc70sRRx7ESTOurRC2xolQKlpXVb/LlSddIclNMRgwDrtfO4cw/3CAfmZ5D/Zqai0a1eK5Or6jwYGICaLv799kenGNONTDrzpGb6uE4MfU9gKV/e6QD5CKJunhir+OZ8gLI4ixbHtDXGYpwcEeemnEyMaghgUwGHZ1MzjSGsS9n6h6VGN9z9orIFzidCYT0NZ8V/kx4vTI6mNuPKezXB//+1bs3R66r9uWKpvwpcT2XLfHcbDpgBu4pHg/E73yPJCrRfGiXR/Hgsjf9IxzoM/MLdIU7htmJ6pMsRYcjuEBeT2IMMkITmOrYwWar/n80NLfNvPLfkWY2kdUqLs/kWoJCaCl37EnqPaJFrzpnm7VBUOgu2e3RpsDu9a8C9UtHZkN1LdjS7SpFb58pFfTxNIBHx938O7MwcAZvsSkt6Is016TMBsS1oZVp65DXaDVRHEs5n+iASmShDp8KIt25bKNYq4=
25
+ matrix:
26
+ allow_failures:
27
+ - rvm: ruby-head
28
+ sudo: false
@@ -0,0 +1,5 @@
1
+ ## master
2
+ [full changelog](http://github.com/sue445/rspec-time_stop/compare/v0.1.0...master)
3
+
4
+ ## v0.1.0
5
+ * first release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rspec-time_stop.gemspec
6
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 sue445
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,75 @@
1
+ # Rspec::TimeStop
2
+ Stop current time in example.
3
+
4
+ This is a shorthand of `ActiveSupport::Testing::TimeHelpers`
5
+
6
+ [![Build Status](https://travis-ci.org/sue445/rspec-time_stop.svg?branch=master)](https://travis-ci.org/sue445/rspec-time_stop)
7
+ [![Coverage Status](https://coveralls.io/repos/github/sue445/rspec-time_stop/badge.svg)](https://coveralls.io/github/sue445/rspec-time_stop)
8
+ [![Maintainability](https://api.codeclimate.com/v1/badges/9f437c78e286285f5605/maintainability)](https://codeclimate.com/github/sue445/rspec-time_stop/maintainability)
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'rspec-time_stop'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install rspec-time_stop
25
+
26
+ ## Usage
27
+
28
+ Add `:time_stop` to `it`, `describe` or `context`
29
+
30
+ ## Example
31
+ ```ruby
32
+ RSpec.describe Rspec::TimeStop do
33
+ context "with :time_stop", :time_stop do
34
+ it "current time is freezed" do
35
+ before_time = Time.now
36
+ sleep 1
37
+ after_time = Time.now
38
+
39
+ expect(after_time).to eq before_time
40
+ end
41
+ end
42
+
43
+ context "without :time_stop" do
44
+ it "current time is not freezed" do
45
+ before_time = Time.now
46
+ sleep 1
47
+ after_time = Time.now
48
+
49
+ expect(after_time).to be > before_time
50
+ end
51
+
52
+ it "current time is freezed when :time_stop is granted", :time_stop do
53
+ before_time = Time.now
54
+ sleep 1
55
+ after_time = Time.now
56
+
57
+ expect(after_time).to eq before_time
58
+ end
59
+ end
60
+ end
61
+ ```
62
+
63
+ ## Development
64
+
65
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
66
+
67
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
68
+
69
+ ## Contributing
70
+
71
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sue445/rspec-time_stop.
72
+
73
+ ## License
74
+
75
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rspec/time_stop"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ require "rspec/time_stop"
@@ -0,0 +1,17 @@
1
+ require "rspec/time_stop/version"
2
+ require "rspec"
3
+ require "active_support/testing/time_helpers"
4
+
5
+ RSpec.shared_context "rspec-time_stop", shared_context: :metadata do
6
+ include ActiveSupport::Testing::TimeHelpers
7
+
8
+ around(:each) do |example|
9
+ travel_to(Time.now) do
10
+ example.run
11
+ end
12
+ end
13
+ end
14
+
15
+ RSpec.configure do |rspec|
16
+ rspec.include_context "rspec-time_stop", time_stop: true
17
+ end
@@ -0,0 +1,5 @@
1
+ module Rspec
2
+ module TimeStop
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "rspec/time_stop/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec-time_stop"
8
+ spec.version = Rspec::TimeStop::VERSION
9
+ spec.authors = ["sue445"]
10
+ spec.email = ["sue445@sue445.net"]
11
+
12
+ spec.summary = %q{Stop current time in example.}
13
+ spec.description = %q{Stop current time in example.}
14
+ spec.homepage = "https://github.com/sue445/rspec-time_stop"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "activesupport", ">= 4.1.0"
27
+ spec.add_dependency "rspec"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.16"
30
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
31
+ spec.add_development_dependency "coveralls"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "simplecov"
34
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-time_stop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - sue445
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Stop current time in example.
112
+ email:
113
+ - sue445@sue445.net
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".coveralls.yml"
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - CHANGELOG.md
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - lib/rspec-time_stop.rb
130
+ - lib/rspec/time_stop.rb
131
+ - lib/rspec/time_stop/version.rb
132
+ - rspec-time_stop.gemspec
133
+ homepage: https://github.com/sue445/rspec-time_stop
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.7.6
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Stop current time in example.
157
+ test_files: []