From 1939c4049d5195ffdd967485f50119bdd86e98a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20G=C3=BCnnewig?= Date: Mon, 31 Aug 2015 14:18:03 +0200 Subject: [PATCH] Fixed problem with all-matcher by using module_function --- lib/aruba/api/deprecated.rb | 2 +- lib/aruba/api/filesystem.rb | 2 +- lib/aruba/cucumber/file.rb | 4 ++-- lib/aruba/matchers/collection/all.rb | 9 +++++++++ lib/aruba/matchers/collection/all_objects.rb | 2 -- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 lib/aruba/matchers/collection/all.rb delete mode 100644 lib/aruba/matchers/collection/all_objects.rb diff --git a/lib/aruba/api/deprecated.rb b/lib/aruba/api/deprecated.rb index 63a5718e1..af7e00280 100644 --- a/lib/aruba/api/deprecated.rb +++ b/lib/aruba/api/deprecated.rb @@ -133,7 +133,7 @@ def touch_file(*args) def mod?(file, perms, &block) Aruba.platform.deprecated('The use of "#mod?" is deprecated. Use "expect().to have_permissions()" instead') - expect(Array(file)).to all_objects have_permissions(perms) + expect(Array(file)).to Aruba::Matchers.all have_permissions(perms) end # @deprecated diff --git a/lib/aruba/api/filesystem.rb b/lib/aruba/api/filesystem.rb index cb1347ff1..a129aaa9d 100644 --- a/lib/aruba/api/filesystem.rb +++ b/lib/aruba/api/filesystem.rb @@ -360,7 +360,7 @@ def with_file_content(file, &block) # @result [FileSize] # Bytes on disk def disk_usage(*paths) - expect(paths.flatten).to all_objects be_an_existing_path + expect(paths.flatten).to Aruba::Matchers.all be_an_existing_path Aruba.platform.determine_disk_usage paths.flatten.map { |p| ArubaPath.new(expand_path(p)) }, aruba.config.physical_block_size end diff --git a/lib/aruba/cucumber/file.rb b/lib/aruba/cucumber/file.rb index 15f57ee86..12a9b7cbe 100644 --- a/lib/aruba/cucumber/file.rb +++ b/lib/aruba/cucumber/file.rb @@ -92,7 +92,7 @@ if negated expect(files).not_to include an_existing_file else - expect(files).to all_objects be_an_existing_file + expect(files).to Aruba::Matchers.all be_an_existing_file end end @@ -126,7 +126,7 @@ if negated expect(directories).not_to include an_existing_directory else - expect(directories).to all_objects be_an_existing_directory + expect(directories).to Aruba::Matchers.all be_an_existing_directory end end diff --git a/lib/aruba/matchers/collection/all.rb b/lib/aruba/matchers/collection/all.rb new file mode 100644 index 000000000..6f10959ee --- /dev/null +++ b/lib/aruba/matchers/collection/all.rb @@ -0,0 +1,9 @@ +require 'rspec/expectations' + +module Aruba + module Matchers + include ::RSpec::Matchers + + module_function :all + end +end diff --git a/lib/aruba/matchers/collection/all_objects.rb b/lib/aruba/matchers/collection/all_objects.rb deleted file mode 100644 index 68af94658..000000000 --- a/lib/aruba/matchers/collection/all_objects.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Let's alias :all to have a name which has no conflicts with other libraries -RSpec::Matchers.alias_matcher :all_objects, :all