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:
commit
a682ca1600
2
Gemfile
2
Gemfile
|
@ -21,7 +21,7 @@ gem 'mime-types', '~> 1.5'
|
||||||
gem 'jekyll_test_plugin'
|
gem 'jekyll_test_plugin'
|
||||||
gem 'jekyll_test_plugin_malicious'
|
gem 'jekyll_test_plugin_malicious'
|
||||||
gem 'liquid-c', '~> 3.0'
|
gem 'liquid-c', '~> 3.0'
|
||||||
gem 'minitest', '5.5.1'
|
gem 'minitest'
|
||||||
gem 'minitest-reporters'
|
gem 'minitest-reporters'
|
||||||
gem 'minitest-profile'
|
gem 'minitest-profile'
|
||||||
gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
gem 'test-unit' if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
|
||||||
|
|
|
@ -32,6 +32,11 @@ Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => tru
|
||||||
class JekyllUnitTest < Minitest::Test
|
class JekyllUnitTest < Minitest::Test
|
||||||
include ::RSpec::Mocks::ExampleMethods
|
include ::RSpec::Mocks::ExampleMethods
|
||||||
|
|
||||||
|
def mocks_expect(*args)
|
||||||
|
RSpec::Mocks::ExampleMethods::ExpectHost.instance_method(:expect).\
|
||||||
|
bind(self).call(*args)
|
||||||
|
end
|
||||||
|
|
||||||
def before_setup
|
def before_setup
|
||||||
::RSpec::Mocks.setup
|
::RSpec::Mocks.setup
|
||||||
super
|
super
|
||||||
|
|
|
@ -4,10 +4,11 @@ class TestCommand < JekyllUnitTest
|
||||||
context "when calling .add_build_options" do
|
context "when calling .add_build_options" do
|
||||||
should "add common options" do
|
should "add common options" do
|
||||||
cmd = Object.new
|
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)
|
Command.add_build_options(cmd)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when calling .process_site" do
|
context "when calling .process_site" do
|
||||||
context "when fatal error occurs" do
|
context "when fatal error occurs" do
|
||||||
should "exit with non-zero error code" do
|
should "exit with non-zero error code" do
|
||||||
|
|
Loading…
Reference in New Issue