minder 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ require 'minder/pomodoro'
2
+
3
+ describe Minder::Pomodoro do
4
+ describe '#run' do
5
+ let(:timer) { instance_spy(Minder::Timer) }
6
+
7
+ it 'runs the pomodoro' do
8
+ pomodoro = described_class.new(minutes: 5)
9
+
10
+ allow(Minder::Timer).to receive(:new)
11
+ .with(seconds: 300)
12
+ .and_return(timer)
13
+ allow(timer).to receive(:completed?).and_return(false, true)
14
+ allow($stdout).to receive(:flush)
15
+ allow(pomodoro).to receive(:puts)
16
+ allow(pomodoro).to receive(:print)
17
+
18
+ pomodoro.run
19
+
20
+ expect(pomodoro).to have_received(:puts).with('Work period')
21
+ expect(timer).to have_received(:start!)
22
+ expect(timer).to have_received(:tick).at_least(:once)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,83 @@
1
+ require 'minder/timer'
2
+ require 'timecop'
3
+
4
+ describe Minder::Timer do
5
+ after do
6
+ Timecop.return
7
+ end
8
+
9
+ describe '#initialize' do
10
+ it 'sets seconds' do
11
+ expect(Minder::Timer.new(seconds: 30).seconds).to eq(30)
12
+ end
13
+
14
+ it 'sets seconds to 25 minutes by default' do
15
+ expect(Minder::Timer.new.seconds).to eq(25 * 60)
16
+ end
17
+ end
18
+
19
+ describe '#start!' do
20
+ it 'sets the start time' do
21
+ now = Time.new(2015, 5, 1, 12, 30)
22
+ Timecop.freeze(now)
23
+ minder = Minder::Timer.new
24
+ minder.start!
25
+ Timecop.return
26
+
27
+ later = Time.new(2015, 5, 1, 13, 0)
28
+ Timecop.travel(later)
29
+ expect(minder.start_time).to eq(now)
30
+ end
31
+ end
32
+
33
+ describe '#completed?' do
34
+ it "is false if the passed seconds hasn't elapsed yet" do
35
+ now = Time.new(2015, 5, 1, 12, 30)
36
+ Timecop.freeze(now)
37
+ minder = Minder::Timer.new(seconds: 10 * 60)
38
+ minder.start!
39
+ Timecop.return
40
+
41
+ later = Time.new(2015, 5, 1, 12, 39)
42
+ Timecop.travel(later)
43
+ expect(minder.completed?).to eq(false)
44
+ end
45
+
46
+ it "is true if the passed seconds has already elapsed" do
47
+ now = Time.new(2015, 5, 1, 12, 30)
48
+ Timecop.freeze(now)
49
+ minder = Minder::Timer.new(seconds: 10 * 60)
50
+ minder.start!
51
+ Timecop.return
52
+
53
+ later = Time.new(2015, 5, 1, 12, 41)
54
+ Timecop.travel(later)
55
+ expect(minder.completed?).to eq(true)
56
+ end
57
+ end
58
+
59
+ describe '#elapsed_time' do
60
+ it 'is 0 if start has not been called' do
61
+ now = Time.new(2015, 5, 1, 12, 30, 10)
62
+ Timecop.freeze(now)
63
+ minder = Minder::Timer.new(seconds: 10 * 60)
64
+ Timecop.return
65
+
66
+ later = Time.new(2015, 5, 1, 12, 30, 30)
67
+ Timecop.travel(later)
68
+ expect(minder.elapsed_time).to eq(0)
69
+ end
70
+
71
+ it 'is the number of seconds from the start time to the end time' do
72
+ now = Time.new(2015, 5, 1, 12, 30, 10)
73
+ Timecop.freeze(now)
74
+ minder = Minder::Timer.new(seconds: 10 * 60)
75
+ minder.start!
76
+ Timecop.return
77
+
78
+ later = Time.new(2015, 5, 1, 12, 30, 30)
79
+ Timecop.travel(later)
80
+ expect(minder.elapsed_time).to be_within(1).of(20)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,91 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+ RSpec.configure do |config|
20
+ # rspec-expectations config goes here. You can use an alternate
21
+ # assertion/expectation library such as wrong or the stdlib/minitest
22
+ # assertions if you prefer.
23
+ config.expect_with :rspec do |expectations|
24
+ # This option will default to `true` in RSpec 4. It makes the `description`
25
+ # and `failure_message` of custom matchers include text for helper methods
26
+ # defined using `chain`, e.g.:
27
+ # be_bigger_than(2).and_smaller_than(4).description
28
+ # # => "be bigger than 2 and smaller than 4"
29
+ # ...rather than:
30
+ # # => "be bigger than 2"
31
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32
+ end
33
+
34
+ # rspec-mocks config goes here. You can use an alternate test double
35
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
36
+ config.mock_with :rspec do |mocks|
37
+ # Prevents you from mocking or stubbing a method that does not exist on
38
+ # a real object. This is generally recommended, and will default to
39
+ # `true` in RSpec 4.
40
+ mocks.verify_partial_doubles = true
41
+ end
42
+
43
+ # The settings below are suggested to provide a good initial experience
44
+ # with RSpec, but feel free to customize to your heart's content.
45
+ =begin
46
+ # These two settings work together to allow you to limit a spec run
47
+ # to individual examples or groups you care about by tagging them with
48
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
49
+ # get run.
50
+ config.filter_run :focus
51
+ config.run_all_when_everything_filtered = true
52
+
53
+ # Limits the available syntax to the non-monkey patched syntax that is
54
+ # recommended. For more details, see:
55
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
56
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
57
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
58
+ config.disable_monkey_patching!
59
+
60
+ # This setting enables warnings. It's recommended, but in some cases may
61
+ # be too noisy due to issues in dependencies.
62
+ config.warnings = true
63
+
64
+ # Many RSpec users commonly either run the entire suite or an individual
65
+ # file, and it's useful to allow more verbose output when running an
66
+ # individual spec file.
67
+ if config.files_to_run.one?
68
+ # Use the documentation formatter for detailed output,
69
+ # unless a formatter has already been configured
70
+ # (e.g. via a command-line flag).
71
+ config.default_formatter = 'doc'
72
+ end
73
+
74
+ # Print the 10 slowest examples and example groups at the
75
+ # end of the spec run, to help surface which specs are running
76
+ # particularly slow.
77
+ config.profile_examples = 10
78
+
79
+ # Run specs in random order to surface order dependencies. If you find an
80
+ # order dependency and want to debug it, you can fix the order by providing
81
+ # the seed, which is printed after each run.
82
+ # --seed 1234
83
+ config.order = :random
84
+
85
+ # Seed global randomization in this process using the `--seed` CLI option.
86
+ # Setting this allows you to use `--seed` to deterministically reproduce
87
+ # test failures related to randomization by passing the same `--seed` value
88
+ # as the one that triggered the failure.
89
+ Kernel.srand config.seed
90
+ =end
91
+ end
metadata ADDED
@@ -0,0 +1,235 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minder
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Joseph Method
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: curses
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: virtus
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.5
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.5
53
+ - !ruby/object:Gem::Dependency
54
+ name: bundler
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '3.2'
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '3.2'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.2'
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '3.2'
87
+ - !ruby/object:Gem::Dependency
88
+ name: timecop
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: '0.7'
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.3
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.7'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 0.7.3
107
+ - !ruby/object:Gem::Dependency
108
+ name: pry
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '0.10'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0.10'
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '0.10'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0.10'
127
+ - !ruby/object:Gem::Dependency
128
+ name: pry-byebug
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '3.1'
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 3.1.0
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '3.1'
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 3.1.0
147
+ - !ruby/object:Gem::Dependency
148
+ name: pry-stack_explorer
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: 0.4.9
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: 0.4.9
161
+ description: Productivity tool borrowing a little from everything.
162
+ email:
163
+ - tristil@gmail.com
164
+ executables:
165
+ - minder
166
+ extensions: []
167
+ extra_rdoc_files: []
168
+ files:
169
+ - ".rspec"
170
+ - ".ruby-version"
171
+ - Gemfile
172
+ - Gemfile.lock
173
+ - LICENSE.txt
174
+ - README.md
175
+ - assets/done.wav
176
+ - assets/start.wav
177
+ - bin/minder
178
+ - lib/minder.rb
179
+ - lib/minder/application.rb
180
+ - lib/minder/break_period.rb
181
+ - lib/minder/config.rb
182
+ - lib/minder/frame.rb
183
+ - lib/minder/idle_period.rb
184
+ - lib/minder/message_frame.rb
185
+ - lib/minder/period.rb
186
+ - lib/minder/pomodoro_frame.rb
187
+ - lib/minder/pomodoro_period.rb
188
+ - lib/minder/pomodoro_runner.rb
189
+ - lib/minder/quick_add_frame.rb
190
+ - lib/minder/scene.rb
191
+ - lib/minder/task.rb
192
+ - lib/minder/task_recorder.rb
193
+ - lib/minder/timer.rb
194
+ - lib/minder/version.rb
195
+ - minder.gemspec
196
+ - spec/minder/application_spec.rb
197
+ - spec/minder/config_spec.rb
198
+ - spec/minder/pomodoro_break_spec.rb
199
+ - spec/minder/pomodoro_runner_spec.rb
200
+ - spec/minder/pomodoro_spec.rb
201
+ - spec/minder/timer_spec.rb
202
+ - spec/spec_helper.rb
203
+ homepage: http://github.com/tristil/minder
204
+ licenses:
205
+ - MIT
206
+ metadata: {}
207
+ post_install_message:
208
+ rdoc_options: []
209
+ require_paths:
210
+ - lib
211
+ required_ruby_version: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ">="
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ requirements: []
222
+ rubyforge_project:
223
+ rubygems_version: 2.4.5
224
+ signing_key:
225
+ specification_version: 4
226
+ summary: Combines a Pomodoro Technique runner with GTD-style task backlogs and Day
227
+ One-style prompts."
228
+ test_files:
229
+ - spec/minder/application_spec.rb
230
+ - spec/minder/config_spec.rb
231
+ - spec/minder/pomodoro_break_spec.rb
232
+ - spec/minder/pomodoro_runner_spec.rb
233
+ - spec/minder/pomodoro_spec.rb
234
+ - spec/minder/timer_spec.rb
235
+ - spec/spec_helper.rb