-
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.
- Loading branch information
1 parent
81fd0fb
commit 4905c55
Showing
6 changed files
with
135 additions
and
11 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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/integration/deferred/orbit_examples' | ||
|
||
RSpec.describe Spec::Models::Rocket do | ||
subject(:rocket) { described_class.new('Imp IV') } | ||
|
||
include Spec::Integration::Deferred::OrbitExamples | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec/sleeping_king_studios/deferred/examples' | ||
|
||
require 'support/sandbox' | ||
|
||
RSpec.describe RSpec::SleepingKingStudios::Deferred::Examples do | ||
let(:fixture_file) do | ||
%w[spec/integration/deferred/optional_helpers_spec.fixture.rb] | ||
end | ||
let(:result) do | ||
Spec::Support::Sandbox.run(fixture_file) | ||
end | ||
let(:expected_examples) do | ||
<<~EXAMPLES.lines.map(&:strip) | ||
Spec::Models::Rocket#launch when the rocket is launched should set the orbit | ||
Spec::Models::Rocket#launch with orbit: value when the rocket is launched should set the orbit | ||
Spec::Models::Rocket#orbit is expected to equal nil | ||
EXAMPLES | ||
end | ||
|
||
it 'should apply the deferred examples', :aggregate_failures do | ||
expect(result.summary).to be == '3 examples, 0 failures' | ||
|
||
expect(result.example_descriptions).to be == expected_examples | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/integration/deferred' | ||
|
||
module Spec::Integration::Deferred | ||
module ShouldSetTheOrbit | ||
include RSpec::SleepingKingStudios::Deferred::Examples | ||
|
||
let?(:expected_orbit) { nil } | ||
|
||
it 'should set the orbit' do | ||
launch_rocket | ||
|
||
expect(subject.orbit).to eq expected_orbit | ||
end | ||
end | ||
|
||
module OrbitExamples | ||
include RSpec::SleepingKingStudios::Deferred::Examples | ||
|
||
describe '#launch' do | ||
let(:launch_site) { 'KSC' } | ||
let(:options) { {} } | ||
|
||
def launch_rocket | ||
subject.launch(launch_site:, **options) | ||
end | ||
|
||
context 'when the rocket is launched' do # rubocop:disable RSpec/EmptyExampleGroup | ||
include Spec::Integration::Deferred::ShouldSetTheOrbit | ||
end | ||
|
||
describe 'with orbit: value' do | ||
let(:expected_orbit) { options[:orbit] } | ||
let(:options) { { orbit: { periapsis: '100 km', apoapsis: '300 km' } } } | ||
|
||
context 'when the rocket is launched' do # rubocop:disable RSpec/EmptyExampleGroup | ||
include Spec::Integration::Deferred::ShouldSetTheOrbit | ||
end | ||
end | ||
end | ||
|
||
describe '#orbit' do | ||
it { expect(subject.orbit).to be nil } | ||
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