Merge pull request #3658 from jekyll/fix-jekyll-minitest-rspec-mocks

Create #mock_expects that goes directly to RSpec Mocks.
This commit is contained in:
Jordon Bedwell 2015-04-14 15:15:02 -05:00
commit a682ca1600
3 changed files with 8 additions and 2 deletions

View File

@ -21,7 +21,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")

View File

@ -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

View File

@ -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