Skip to content

Commit

Permalink
Parametrize spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Sep 17, 2024
1 parent e49bc62 commit e74d53a
Showing 1 changed file with 22 additions and 74 deletions.
96 changes: 22 additions & 74 deletions spec/tag_release_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@
end
end

platform_contexts = [
{ name: "on ios", repo_name: "duckduckgo/ios" },
{ name: "on macos", repo_name: "duckduckgo/macos-browser" }
]
release_type_contexts = ["for prerelease", "for public release"]
tag_contexts = ["when failed to create tag", "when failed to push tag"]
github_release_contexts = [
{ name: "when failed to fetch latest GitHub release", includes_latest_public_release_tag: false },
Expand All @@ -208,84 +213,27 @@
include_context "common setup"
include_context "local setup"

context "on ios" do
include_context "on ios"

context "for prerelease" do
include_context "for prerelease"
it_behaves_like "successful execution", "duckduckgo/ios"

tag_contexts.each do |context_name|
context context_name do
include_context context_name
it_behaves_like "gracefully handling tagging error"
end
end

github_release_contexts.each do |context_data|
context context_data[:name] do
include_context context_data[:name]
it_behaves_like "gracefully handling GitHub release error", context_data[:includes_latest_public_release_tag]
end
end

context "for public release" do
include_context "for public release"
it_behaves_like "successful execution", "duckduckgo/ios"
platform_contexts.each do |platform_context|
context platform_context[:name] do
include_context platform_context[:name]

tag_contexts.each do |context_name|
context context_name do
include_context context_name
it_behaves_like "gracefully handling tagging error"
end
end
release_type_contexts.each do |release_type_context|
context release_type_context do
include_context release_type_context
it_behaves_like "successful execution", platform_context[:repo_name]

github_release_contexts.each do |context_data|
context context_data[:name] do
include_context context_data[:name]
it_behaves_like "gracefully handling GitHub release error", context_data[:includes_latest_public_release_tag]
tag_contexts.each do |tag_context|
context tag_context do
include_context tag_context
it_behaves_like "gracefully handling tagging error"
end
end
end
end
end

context "on macos" do
include_context "on macos"

context "for prerelease" do
include_context "for prerelease"
it_behaves_like "successful execution", "duckduckgo/macos-browser"

tag_contexts.each do |context_name|
context context_name do
include_context context_name
it_behaves_like "gracefully handling tagging error"
end
end

github_release_contexts.each do |context_data|
context context_data[:name] do
include_context context_data[:name]
it_behaves_like "gracefully handling GitHub release error", context_data[:includes_latest_public_release_tag]
end
end
end

context "for public release" do
include_context "for public release"
it_behaves_like "successful execution", "duckduckgo/macos-browser"

tag_contexts.each do |context_name|
context context_name do
include_context context_name
it_behaves_like "gracefully handling tagging error"
end
end

github_release_contexts.each do |context_data|
context context_data[:name] do
include_context context_data[:name]
it_behaves_like "gracefully handling GitHub release error", context_data[:includes_latest_public_release_tag]
github_release_contexts.each do |github_release_context|
context github_release_context[:name] do
include_context github_release_context[:name]
it_behaves_like "gracefully handling GitHub release error", github_release_context[:includes_latest_public_release_tag]
end
end
end
end
Expand Down

0 comments on commit e74d53a

Please sign in to comment.