Skip to content

Commit

Permalink
Merge pull request #372 from acant/refactor/warnings
Browse files Browse the repository at this point in the history
Cleaning up Ruby warnings and deprecations
  • Loading branch information
grosser committed Aug 22, 2017
2 parents ddb3e68 + 8c79f16 commit d58c538
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ rvm:
- 2.1.1
- 2.2.0
- 2.3.1
- 2.4.1
- jruby-1.7.27
- jruby-9.1.12.0
env:
Expand Down
5 changes: 4 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ require 'bump/tasks'
Rake::TestTask.new do |t|
t.test_files = FileList['test/**/*test.rb']
t.verbose = true
t.warning = true
end

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = '--warnings'
end

require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
Expand Down
2 changes: 2 additions & 0 deletions lib/fakefs/dir.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'English'

module FakeFS
# FakeFs Dir class
class Dir
Expand Down
9 changes: 5 additions & 4 deletions lib/fakefs/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,15 @@ def self.executable?(filename)

def self.chown(owner_int, group_int, filename)
file = FileSystem.find(filename)

if owner_int && owner_int != -1
owner_int.is_a?(Fixnum) || fail(TypeError,
"can't convert String into Integer")
owner_int.is_a?(Integer) || fail(TypeError,
"can't convert String into Integer")
file.uid = owner_int
end
if group_int && group_int != -1
group_int.is_a?(Fixnum) || fail(TypeError,
"can't convert String into Integer")
group_int.is_a?(Integer) || fail(TypeError,
"can't convert String into Integer")
file.gid = group_int
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/fake/file/join_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../test_helper'

# File join test class
class FileJoin < Minitest::Test
class FakeFileJoinTest < Minitest::Test
def setup
FakeFS.activate!
end
Expand Down
2 changes: 1 addition & 1 deletion test/fake/file/lstat_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../test_helper'

# File stat test class
class FileStat < Minitest::Test
class FakeFileLstatTest < Minitest::Test
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
Expand Down
2 changes: 1 addition & 1 deletion test/fake/file/stat_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../test_helper'

# File stat test class
class FileStat < Minitest::Test
class FakeFileStatTest < Minitest::Test
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
Expand Down
2 changes: 1 addition & 1 deletion test/fake/file/sysseek_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative '../../test_helper'

# File SysSeek test class
class FileSysSeek < Minitest::Test
class FakeFileSysSeekTest < Minitest::Test
def setup
FakeFS.activate!
FakeFS::FileSystem.clear
Expand Down
3 changes: 1 addition & 2 deletions test/fakefs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,6 @@ def test_can_read_from_file_objects

if RUBY_VERSION >= '1.9'
def test_file_object_has_default_external_encoding
Encoding.default_external = 'UTF-8'
path = 'file.txt'
File.open(path, 'w') { |f| f.write 'Yatta!' }
assert_equal 'UTF-8', File.new(path).read.encoding.name
Expand Down Expand Up @@ -2814,7 +2813,7 @@ def test_autoclose
end

def test_to_path
File.new('foo', 'w') do |f|
File.open('foo', 'w') do |f|
assert_equal 'foo', f.to_path
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/pathname_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative 'test_helper'

# Fake Pathname test class
class FakePathnameTest < Minitest::Test
class PathnameTest < Minitest::Test
include FakeFS

def setup
Expand Down
2 changes: 1 addition & 1 deletion test/safe_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative 'test_helper'

# FakeFS safe test class
class FakeFSSafeTest < Minitest::Test
class SafeTest < Minitest::Test
def setup
FakeFS.deactivate!
end
Expand Down

0 comments on commit d58c538

Please sign in to comment.