diff --git a/Gemfile b/Gemfile index 99b66e00..fe19f448 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'mime-types', '~> 1.5' gem 'jekyll_test_plugin' gem 'jekyll_test_plugin_malicious' gem 'liquid-c', '~> 3.0' -gem 'minitest', '5.5.1' +gem 'minitest' gem 'minitest-reporters' gem 'minitest-profile' gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2") diff --git a/test/helper.rb b/test/helper.rb index 9c5a1eb0..f888507d 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -32,6 +32,11 @@ Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => tru class JekyllUnitTest < Minitest::Test include ::RSpec::Mocks::ExampleMethods + def mocks_expect(*args) + RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).\ + bind(self).call(*args) + end + def before_setup ::RSpec::Mocks.setup super diff --git a/test/test_command.rb b/test/test_command.rb index f7c3e237..7d1211e8 100644 --- a/test/test_command.rb +++ b/test/test_command.rb @@ -4,10 +4,11 @@ class TestCommand < JekyllUnitTest context "when calling .add_build_options" do should "add common options" do cmd = Object.new - expect(cmd).to receive(:option).at_least(:once) + mocks_expect(cmd).to receive(:option).at_least(:once) Command.add_build_options(cmd) end end + context "when calling .process_site" do context "when fatal error occurs" do should "exit with non-zero error code" do