maid 0.5.0 → 0.6.0.alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p247
1
+ 2.1.2
data/.travis.yml CHANGED
@@ -1,6 +1,11 @@
1
1
  language: ruby
2
2
  cache: bundler
3
+ os:
4
+ - linux
5
+ - osx
3
6
  rvm:
4
7
  - 1.9.3
5
8
  - 2.0.0
6
- - 2.1.0-preview2
9
+ - 2.1.0
10
+ - 2.1.1
11
+ - 2.1.2
data/AUTHORS.md CHANGED
@@ -3,6 +3,7 @@ In alphabetical order:
3
3
  * Benjamin Oakes (@benjaminoakes)
4
4
  * Bradley Smith (@bradleyd)
5
5
  * Graham Siener (@gsiener)
6
+ * Jayson Rhynas (@jayrhynas)
6
7
  * John Colvin (@JohnColvin)
7
8
  * Justin Hileman (@bobthecow)
8
9
  * Larry Lv (@larrylv)
@@ -11,5 +12,6 @@ In alphabetical order:
11
12
  * Mark Jaquith (@markjaquith)
12
13
  * Mikael Hultgren (@blomma)
13
14
  * Mu Ye (@yemutex)
15
+ * Pedro Lambert (@p-lambert)
14
16
  * Shiro Hazuki (@HazukiShiro)
15
17
  * Vladimir Agafonkin (@mourner)
data/ChangeLog CHANGED
@@ -1,5 +1,15 @@
1
+ maid (0.6.0) unstable; urgency=low
2
+
3
+ * Jayson Rhynas: Add Safari download detection to "downloading?" (Closes: #121)
4
+ * Pedro Lambert: Add support for Rake tasks defined by Maid (Closes: #68, #123)
5
+
6
+ -- Benjamin Oakes <hello@benjaminoakes.com> TODO
7
+
1
8
  maid (0.5.0) stable; urgency=low
2
9
 
10
+ * Stats! { 'collaborators' => 13, 'downloads' => 9570, 'forks' => 38,
11
+ 'open_issues' => 28, 'closed_issues' => 86, 'stars' => 722,
12
+ 'users_sharing_rules' => 25 }
3
13
  * Started official support Ruby 2.1.0 (Closes: #114)
4
14
  * Shiro Hazuki (public domain code): New utility methods: "dir_safe",
5
15
  "downloading?" (Closes: #107)
data/README.md CHANGED
@@ -85,7 +85,7 @@ Modern Ruby versions and Unix-like operating systems should work, but only OS X
85
85
  Offically supported:
86
86
 
87
87
  * **OS:** Mac OS X, Ubuntu
88
- * **Ruby:** 1.9.3+ (2.0.0 or 2.1.0 are preferred)
88
+ * **Ruby:** 1.9.3+ (2.0.0, 2.1.0, or 2.1.1 are preferred)
89
89
 
90
90
  Some features require OS X. See the [documentation][] for more details.
91
91
 
@@ -210,6 +210,30 @@ Example for every day at 1am:
210
210
  # minute hour day_of_month month day_of_week command_to_execute
211
211
  0 1 * * * /bin/bash -li -c "maid clean --force --silent"
212
212
 
213
+ ### Rake Tasks
214
+
215
+ Maid includes helpers that make file managment easier. You may find them useful if you need to automate tasks in your Ruby projects. This is available via support for Maid-based Rake tasks:
216
+
217
+ ```ruby
218
+ # File: Rakefile
219
+ require 'maid'
220
+
221
+ Maid::Rake::Task.new :clean do
222
+ # Clean up Rubinius-compilied Ruby
223
+ trash(dir('**/*.rbc'))
224
+ end
225
+ ```
226
+
227
+ In fact, the Maid project uses Maid in [its Rakefile](https://github.com/benjaminoakes/maid/blob/master/Rakefile).
228
+
229
+ You can also provide a custom description:
230
+
231
+ ```ruby
232
+ Maid::Rake::Task.new clean_torrents: [:dependency], description: 'Clean Torrents' do
233
+ trash(dir('~/Downloads/*.torrent'))
234
+ end
235
+ ```
236
+
213
237
  ## Warranty
214
238
 
215
239
  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'bundler'
2
+ require 'maid'
2
3
  require 'rake'
3
4
  require 'rspec/core/rake_task'
4
5
  require 'yard'
@@ -12,3 +13,12 @@ YARD::Rake::YardocTask.new
12
13
  task :console do
13
14
  sh('irb -I lib -r maid')
14
15
  end
16
+
17
+ Maid::Rake::Task.new :clean do
18
+ # Clean up Rubinius-compilied Ruby
19
+ trash(dir('**/*.rbc'))
20
+
21
+ # Get rid of old rubygems packages
22
+ trash('pkg')
23
+ mkdir('pkg')
24
+ end
@@ -0,0 +1,34 @@
1
+ module Maid
2
+ module Rake
3
+ class SingleRule
4
+ attr_writer :maid_instance
5
+ attr_reader :name, :task
6
+
7
+ def initialize(name, task)
8
+ @name = name
9
+ @task = task
10
+ end
11
+
12
+ def clean
13
+ maid_instance.clean
14
+ end
15
+
16
+ def maid_instance
17
+ @maid_instance ||= ::Maid::Maid.new(rules_path: '/dev/null')
18
+ end
19
+
20
+ def define
21
+ maid_instance.rule name do
22
+ maid_instance.instance_eval(&task)
23
+ end
24
+ self
25
+ end
26
+
27
+ class << self
28
+ def perform(name, task)
29
+ new(name, task).define.clean
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,38 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+
4
+ module Maid
5
+ module Rake
6
+ class Task < ::Rake::TaskLib
7
+ DEFAULT_DESCRIPTION = 'Maid Task'
8
+
9
+ def initialize(*args, &task)
10
+ @args = args
11
+ @task_proc = task
12
+ define
13
+ end
14
+
15
+ private
16
+
17
+ attr_reader :task_proc
18
+
19
+ def args
20
+ @args.reject(&:empty?)
21
+ end
22
+
23
+ def task_description
24
+ @task_description ||= begin
25
+ opts = args.detect { |arg| arg.is_a?(Hash) }
26
+ (opts && opts.delete(:description)) || DEFAULT_DESCRIPTION
27
+ end
28
+ end
29
+
30
+ def define
31
+ desc task_description
32
+ task *args do |task|
33
+ SingleRule.perform(task.name, task_proc)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
data/lib/maid/tools.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'digest/md5'
1
+ require 'digest/sha1'
2
2
  require 'find'
3
3
  require 'fileutils'
4
4
  require 'time'
@@ -28,11 +28,11 @@ module Maid::Tools
28
28
  # Single path:
29
29
  #
30
30
  # move('~/Downloads/foo.zip', '~/Archive/Software/Mac OS X/')
31
- #
31
+ #
32
32
  # Multiple paths:
33
33
  #
34
34
  # move(['~/Downloads/foo.zip', '~/Downloads/bar.zip'], '~/Archive/Software/Mac OS X/')
35
- # move(dir('~/Downloads/*.zip'), '~/Archive/Software/Mac OS X/')
35
+ # move(dir('~/Downloads/*.zip'), '~/Archive/Software/Mac OS X/')
36
36
  def move(sources, destination)
37
37
  destination = expand(destination)
38
38
 
@@ -84,11 +84,11 @@ module Maid::Tools
84
84
  #
85
85
  # The path is still moved if a file already exists in the trash with the same name. However, the current date and
86
86
  # time is appended to the filename.
87
- #
87
+ #
88
88
  # **Note:** the OS-native "restore" or "put back" functionality for trashed files is not currently supported. (See
89
89
  # [issue #63](https://github.com/benjaminoakes/maid/issues/63).) However, they can be restored manually, and the Maid
90
90
  # log can help assist with this.
91
- #
91
+ #
92
92
  # ## Options
93
93
  #
94
94
  # `:remove_over => Fixnum` (e.g. `1.gigabyte`, `1024.megabytes`)
@@ -102,7 +102,7 @@ module Maid::Tools
102
102
  # Single path:
103
103
  #
104
104
  # trash('~/Downloads/foo.zip')
105
- #
105
+ #
106
106
  # Multiple paths:
107
107
  #
108
108
  # trash(['~/Downloads/foo.zip', '~/Downloads/bar.zip'])
@@ -146,7 +146,7 @@ module Maid::Tools
146
146
  # Delete the files at the given path recursively.
147
147
  #
148
148
  # **NOTE**: In most cases, `trash` is a safer choice, since the files will be recoverable by retreiving them from the trash. Once you delete a file using `remove`, it's gone! Please use `trash` whenever possible and only use `remove` when necessary.
149
- #
149
+ #
150
150
  # ## Options
151
151
  #
152
152
  # `:force => boolean`
@@ -234,11 +234,11 @@ module Maid::Tools
234
234
  dir(globs).
235
235
  select { |f| File.file?(f) }
236
236
  end
237
-
237
+
238
238
  # Escape characters that have special meaning as a part of path global patterns.
239
239
  #
240
240
  # Useful when using `dir` with file names that may contain `{ } [ ]` characters.
241
- #
241
+ #
242
242
  # ## Example
243
243
  #
244
244
  # escape_glob('test [tmp]') # => 'test \\[tmp\\]'
@@ -328,7 +328,7 @@ module Maid::Tools
328
328
  #
329
329
  # See also: `dir_safe`
330
330
  def downloading?(path)
331
- chrome_downloading?(path) || firefox_downloading?(path)
331
+ !!(chrome_downloading?(path) || firefox_downloading?(path) || safari_downloading?(path))
332
332
  end
333
333
 
334
334
  # Find all duplicate files in the given globs.
@@ -430,7 +430,7 @@ module Maid::Tools
430
430
  raw = cmd("du -s #{ sh_escape(path) }")
431
431
  # FIXME: This reports in kilobytes, but should probably report in bytes.
432
432
  usage_kb = raw.split(/\s+/).first.to_i
433
-
433
+
434
434
  if usage_kb.zero?
435
435
  raise "Stopping pessimistically because of unexpected value from du (#{ raw.inspect })"
436
436
  else
@@ -493,9 +493,9 @@ module Maid::Tools
493
493
  #
494
494
  # ## Examples
495
495
  #
496
- # checksum_of('foo.zip') # => "ae8dbb203dfd560158083e5de90969c2"
496
+ # checksum_of('foo.zip') # => "67258d750ca654d5d3c7b06bd2a1c792ced2003e"
497
497
  def checksum_of(path)
498
- Digest::MD5.hexdigest(File.read(path))
498
+ Digest::SHA1.hexdigest(File.read(path))
499
499
  end
500
500
 
501
501
  # @deprecated
@@ -521,7 +521,7 @@ module Maid::Tools
521
521
  # The host OS must provide `rsync`. See the `rsync` man page for a detailed description.
522
522
  #
523
523
  # man rsync
524
- #
524
+ #
525
525
  # ## Options
526
526
  #
527
527
  # `:delete => boolean`
@@ -610,7 +610,7 @@ module Maid::Tools
610
610
  # media_type('bar.jpg') # => "image"
611
611
  def media_type(path)
612
612
  type = MIME::Types.type_for(path)[0]
613
-
613
+
614
614
  if type
615
615
  type.media_type
616
616
  end
@@ -634,7 +634,7 @@ module Maid::Tools
634
634
  # where_content_type(dir('~/Downloads/*'), 'image/jpeg')
635
635
  #
636
636
  # ### Using Spotlight content types
637
- #
637
+ #
638
638
  # Less portable, but richer data in some cases.
639
639
  #
640
640
  # where_content_type(dir('~/Downloads/*'), 'public.image')
@@ -654,6 +654,10 @@ module Maid::Tools
654
654
  path =~ /\.crdownload$/
655
655
  end
656
656
 
657
+ def safari_downloading?(path)
658
+ path =~ /\.download$/
659
+ end
660
+
657
661
  def sh_escape(array)
658
662
  Escape.shell_command(Array(array))
659
663
  end
@@ -681,4 +685,19 @@ module Maid::Tools
681
685
  clean = raw[1, raw.length - 2]
682
686
  clean.split(/,\s+/).map { |s| t = s.strip; t[1, t.length - 2] }
683
687
  end
688
+
689
+ # ---
690
+ # Something @benjaminoakes wrote:
691
+
692
+ # Maid.rules do
693
+ # dir('*-2012.pdf').each do |p|
694
+ # move(p, normalize_date(p))
695
+ # end
696
+ # end
697
+
698
+ def normalize_date(path)
699
+ basename = File.basename(path, '.pdf')
700
+ latent_date = Date.strptime(basename, '%m-%d-%Y')
701
+ latent_date.strftime('%Y.%m.%d.pdf')
702
+ end
684
703
  end
data/lib/maid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Maid
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0.alpha.1'
3
3
  end
data/lib/maid.rb CHANGED
@@ -11,6 +11,8 @@ require 'maid/maid'
11
11
  require 'maid/app'
12
12
  require 'maid/numeric_extensions'
13
13
  require 'maid/platform'
14
+ require 'maid/rake/single_rule'
15
+ require 'maid/rake/task'
14
16
  require 'maid/rule'
15
17
  require 'maid/trash_migration'
16
18
  require 'maid/user_agent'
data/maid.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
 
20
20
  # Strategy: if possible, use ranges (so there are fewer chances of version conflicts)
21
21
  s.add_dependency('escape', '>= 0.0.1', '< 0.1.0') # Used for better Ruby 1.8.7 support, could be replaced with `Shellwords`
22
- s.add_dependency('thor', '>= 0.14.0', '< 0.19.0')
22
+ s.add_dependency('thor', '>= 0.14.0', '< 1.0.0')
23
23
  s.add_dependency('deprecated', '~> 3.0.0')
24
24
  s.add_dependency('mime-types', '~> 2.0')
25
25
  s.add_dependency('rubyzip', '~> 1.1.0')
@@ -32,11 +32,11 @@ Gem::Specification.new do |s|
32
32
  # Strategy: specific versions (since they're just for development)
33
33
  s.add_development_dependency('fakefs', '~> 0.4.2')
34
34
  s.add_development_dependency('guard', '~> 2.2.2')
35
- s.add_development_dependency('guard-rspec', '~> 4.0.3')
35
+ s.add_development_dependency('guard-rspec', '~> 4.2.1')
36
36
  s.add_development_dependency('rake', '~> 10.1.0')
37
37
  s.add_development_dependency('redcarpet', '~> 3.0.0') # Soft dependency of `yard`
38
- s.add_development_dependency('rspec', '~> 2.14.1')
39
- s.add_development_dependency('timecop', '~> 0.6.3')
38
+ s.add_development_dependency('rspec', '>= 2.14', '< 3.0')
39
+ s.add_development_dependency('timecop', '~> 0.7.0')
40
40
  s.add_development_dependency('yard', '~> 0.8.4')
41
41
 
42
42
  # In Vagrant, polling won't cross over the OS boundary if you develop in the host OS but run your tests in the
@@ -22,11 +22,14 @@ function install-pkg-if-ruby {
22
22
  fi
23
23
  }
24
24
 
25
+ sudo apt-get update
26
+ sudo apt-get install -y python-software-properties
27
+ sudo add-apt-repository -y ppa:brightbox/ruby-ng
25
28
  sudo apt-get update
26
29
 
27
- # ## Dependencies
28
- # Installs `ruby 1.9.3p0`
29
- install-pkg-if-ruby '1.9.3' 'ruby1.9.1'
30
+ ## Dependencies
31
+ install-pkg-if-ruby '2.1.0' 'ruby2.1'
32
+ install-pkg-if-ruby '1.9.3' 'ruby1.9.1' # Installs `ruby 1.9.3p0`
30
33
  install-pkg-if-ruby 'jruby' 'jruby'
31
34
 
32
35
  # ## Development dependencies
@@ -38,6 +41,14 @@ install-pkg 'make'
38
41
  install-pkg 'libffi-dev'
39
42
  install-pkg-if-ruby '1.9.3' 'ruby1.9.1-dev'
40
43
 
44
+ # # wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
45
+ # wget 'http://192.168.0.1:3000/serv/Software/Source/ruby-2.1.1.tar.gz'
46
+ # tar xvfz ruby-2.1.1.tar.gz
47
+ # cd ruby-2.1.1
48
+ # ./configure
49
+ # make
50
+ # sudo make install
51
+
41
52
  sudo gem install bundler
42
53
  cd /vagrant
43
54
  bundle install
@@ -23,31 +23,31 @@ describe 'Dependency expectations' do
23
23
  logger = Logger.new(io)
24
24
  logger.info('my message')
25
25
  logger.formatter = lambda { |_, _, _, msg| msg }
26
- io.string.should match(/my message/)
26
+ expect(io.string).to match(/my message/)
27
27
  end
28
28
  end
29
29
 
30
30
  describe MIME::Types do
31
31
  it 'reports media types and sub types when given a path' do
32
32
  types = MIME::Types.type_for('anything.jpg')
33
- types.length.should == 1
33
+ expect(types.length).to eq(1)
34
34
  type = types[0]
35
- type.media_type.should == 'image'
36
- type.sub_type.should == 'jpeg'
35
+ expect(type.media_type).to eq('image')
36
+ expect(type.sub_type).to eq('jpeg')
37
37
  end
38
38
 
39
39
  context 'when the type is unknown' do
40
40
  it 'returns []' do
41
41
  types = MIME::Types.type_for('unknown.foo')
42
- types.length.should == 0
43
- types[0].should be_nil
42
+ expect(types.length).to eq(0)
43
+ expect(types[0]).to be_nil
44
44
  end
45
45
  end
46
46
  end
47
47
 
48
48
  describe RbConfig do
49
49
  it 'identifies the host operating system' do
50
- RbConfig::CONFIG['host_os'].should match(/[a-z]+/)
50
+ expect(RbConfig::CONFIG['host_os']).to match(/[a-z]+/)
51
51
  end
52
52
  end
53
53
 
@@ -59,21 +59,21 @@ describe 'Dependency expectations' do
59
59
  # More info:
60
60
  #
61
61
  # * [XDG Base Directory Specification](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)
62
- XDG['DATA_HOME'].to_s.should match(%r{^/.*?/\.local/share$})
62
+ expect(XDG['DATA_HOME'].to_s).to match(%r{^/.*?/\.local/share$})
63
63
  end
64
64
  end
65
65
 
66
66
  describe Zip::File do
67
67
  it 'makes entries available with #entries' do
68
68
  Zip::File.open("#@file_fixtures_path/foo.zip") do |zip_file|
69
- zip_file.entries.map { |entry| entry.name }.sort.should == %w(README.txt foo.exe subdir/anything.txt)
69
+ expect(zip_file.entries.map { |entry| entry.name }).to match_array(%w(README.txt foo.exe subdir/anything.txt))
70
70
  end
71
71
  end
72
72
 
73
73
  it 'supports UTF-8 filenames' do
74
74
  # Filename is a Japanese character
75
75
  Zip::File.open("#@file_fixtures_path/\343\201\225.zip") do |zip_file|
76
- zip_file.entries.map { |entry| entry.name }.should == %w(anything.txt)
76
+ expect(zip_file.entries.map { |entry| entry.name }).to eq(%w(anything.txt))
77
77
  end
78
78
  end
79
79
  end
@@ -7,7 +7,7 @@ module Maid
7
7
  out = StringIO.new
8
8
  $stdout = out
9
9
  yield
10
- return out
10
+ out.string
11
11
  ensure
12
12
  $stdout = STDOUT
13
13
  end
@@ -16,7 +16,7 @@ module Maid
16
16
  out = StringIO.new
17
17
  $stderr = out
18
18
  yield
19
- return out
19
+ out.string
20
20
  ensure
21
21
  $stderr = STDERR
22
22
  end
@@ -36,41 +36,41 @@ module Maid
36
36
  Maid.stub(:new) { @maid }
37
37
  end
38
38
 
39
- it 'should make a new Maid with the options' do
39
+ it 'makes a new Maid with the options' do
40
40
  opts = { :foo => 'bar' }
41
41
  @app.stub(:maid_options).and_return(opts)
42
- Maid.should_receive(:new).with(opts).and_return(@maid)
42
+ expect(Maid).to receive(:new).with(opts).and_return(@maid)
43
43
  @app.clean
44
44
  end
45
45
 
46
- it 'should clean when --force is specified' do
47
- @maid.should_receive(:clean)
46
+ it 'cleans when --force is specified' do
47
+ expect(@maid).to receive(:clean)
48
48
  App.start(['clean', '--force'])
49
49
  end
50
50
 
51
- it 'should issue deprecation notice when called without option, but still clean' do
52
- @maid.should_receive(:clean).twice
53
- capture_stderr { App.start(['clean']) }.string.should match(/deprecated/)
54
- capture_stderr { App.start(['clean', '--silent']) }.string.should match(/deprecated/)
51
+ it 'issues deprecation notice when called without option, but still clean' do
52
+ expect(@maid).to receive(:clean).twice
53
+ expect(capture_stderr { App.start(['clean']) }).to match(/deprecated/)
54
+ expect(capture_stderr { App.start(['clean', '--silent']) }).to match(/deprecated/)
55
55
  end
56
56
 
57
- it 'should not be silent if not given the --silent option' do
58
- capture_stdout { App.start(['clean', '--force']) }.string.should_not == ''
57
+ it 'is not silent if not given the --silent option' do
58
+ expect(capture_stdout { App.start(['clean', '--force']) }).not_to eq('')
59
59
  end
60
60
 
61
- it 'should be silent if given the --silent option' do
61
+ it 'is silent if given the --silent option' do
62
62
  # TODO: It might even make sense to wrap `maid.clean` in `capture_stdout { ... }`
63
- capture_stdout { App.start(['clean', '--noop', '--silent']) }.string.should == ''
64
- capture_stdout { App.start(['clean', '--force', '--silent']) }.string.should == ''
63
+ expect(capture_stdout { App.start(['clean', '--noop', '--silent']) }).to eq('')
64
+ expect(capture_stdout { App.start(['clean', '--force', '--silent']) }).to eq('')
65
65
  end
66
66
 
67
- it 'should complain about a MISSPELLED option' do
68
- capture_stderr { App.start(['clean', '--slient']) }.string.should match(/Unknown/)
69
- capture_stderr { App.start(['clean', '--noop', '--slient']) }.string.should match(/Unknown/)
67
+ it 'complains about a MISSPELLED option' do
68
+ expect(capture_stderr { App.start(['clean', '--slient']) }).to match(/Unknown/)
69
+ expect(capture_stderr { App.start(['clean', '--noop', '--slient']) }).to match(/Unknown/)
70
70
  end
71
71
 
72
- it 'should complain about an undefined task' do
73
- capture_stderr { App.start(['rules.rb']) }.string.should match(/Could not find/)
72
+ it 'complains about an undefined task' do
73
+ expect(capture_stderr { App.start(['rules.rb']) }).to match(/Could not find/)
74
74
  end
75
75
  end
76
76
 
@@ -79,13 +79,13 @@ module Maid
79
79
  @app = App.new
80
80
  end
81
81
 
82
- it 'should print out the gem version' do
83
- @app.should_receive(:say).with(VERSION)
82
+ it 'prints out the gem version' do
83
+ expect(@app).to receive(:say).with(VERSION)
84
84
  @app.version
85
85
  end
86
86
 
87
87
  it 'is mapped as --version' do
88
- App.start(['--version']).should == @app.version
88
+ expect(App.start(['--version'])).to eq(@app.version)
89
89
  end
90
90
 
91
91
  context 'with the "long" option' do
@@ -97,10 +97,10 @@ module Maid
97
97
  @app.options = options
98
98
  end
99
99
 
100
- it 'should print out the gem version' do
100
+ it 'prints out the gem version' do
101
101
  ua = 'Maid/0.0.1'
102
102
  UserAgent.stub(:value) { ua }
103
- @app.should_receive(:say).with(ua)
103
+ expect(@app).to receive(:say).with(ua)
104
104
  @app.version
105
105
  end
106
106
  end
@@ -111,17 +111,17 @@ module Maid
111
111
  @app = App.new
112
112
  end
113
113
 
114
- it 'should log to STDOUT for testing purposes when given noop' do
114
+ it 'logs to STDOUT for testing purposes when given noop' do
115
115
  opts = @app.maid_options('noop' => true)
116
- opts[:file_options][:noop].should be_true
117
- opts[:logger].should be_false
118
- opts[:log_device].should == STDOUT
119
- opts[:log_formatter].call(nil, nil, nil, 'hello').should == "hello\n"
116
+ expect(opts[:file_options][:noop]).to be(true)
117
+ expect(opts[:logger]).to be(false)
118
+ expect(opts[:log_device]).to eq(STDOUT)
119
+ expect(opts[:log_formatter].call(nil, nil, nil, 'hello')).to eq("hello\n")
120
120
  end
121
121
 
122
- it 'should set the rules path when given rules' do
122
+ it 'sets the rules path when given rules' do
123
123
  opts = @app.maid_options('rules' => 'maid_rules.rb')
124
- opts[:rules_path].should match(/maid_rules.rb$/)
124
+ expect(opts[:rules_path]).to match(/maid_rules.rb$/)
125
125
  end
126
126
  end
127
127
  end