-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example group methods to Deferred::Examples.
- Loading branch information
1 parent
45d354d
commit 2f15b0b
Showing
8 changed files
with
231 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec/sleeping_king_studios/deferred' | ||
require 'rspec/sleeping_king_studios/deferred/call' | ||
|
||
module RSpec::SleepingKingStudios::Deferred | ||
# Value object representing a deferred RSpec example group. | ||
class ExampleGroup < RSpec::SleepingKingStudios::Deferred::Call | ||
# (see RSpec::SleepingKingStudios::Deferred::Call#type) | ||
def type | ||
:example_group | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
spec/rspec/sleeping_king_studios/deferred/example_group_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec/sleeping_king_studios/concerns/example_constants' | ||
require 'rspec/sleeping_king_studios/deferred/example_group' | ||
|
||
require 'support/shared_examples/deferred_call_examples' | ||
|
||
RSpec.describe RSpec::SleepingKingStudios::Deferred::ExampleGroup do | ||
extend RSpec::SleepingKingStudios::Concerns::ExampleConstants | ||
include Spec::Support::SharedExamples::DeferredCallExamples | ||
|
||
subject(:deferred) do | ||
described_class.new(method_name, *arguments, **keywords, &block) | ||
end | ||
|
||
let(:method_name) { :describe } | ||
let(:arguments) { [] } | ||
let(:keywords) { {} } | ||
let(:block) { nil } | ||
let(:receiver) { instance_double(Spec::ExampleGroup, describe: nil) } | ||
|
||
example_class 'Spec::ExampleGroup' do |klass| | ||
klass.define_method(:describe) { |*, **| nil } | ||
end | ||
|
||
include_examples 'should be a deferred call' | ||
|
||
describe '#type' do | ||
it { expect(deferred.type).to be :example_group } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.