Skip to content

Commit

Permalink
Move skip method into helper
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Sep 19, 2024
1 parent 9c6be48 commit 0843a63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spec/jekyll-admin/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:path) { "/" }
let(:uri) { URI.join(server, path) }
let(:response) { Net::HTTP.get_response(uri) }
let(:skip_condition) { Gem.win_platform? || ENV["CI"] }

before do
Open3.popen3(*start_command)
Expand All @@ -24,7 +23,7 @@
context "Jekyll site" do
let(:path) { "/" }

it "serves the Jekyll site", :skip => skip_condition do
it "serves the Jekyll site", :skip => skip_integration_condition do
expect(response.code).to eql("200")
expect(response.body).to match("You're probably looking for")
end
Expand All @@ -33,7 +32,7 @@
context "Admin site" do
let(:path) { "/admin" }

it "serves the Jekyll site", :skip => skip_condition do
it "serves the Jekyll site", :skip => skip_integration_condition do
with_index_stubbed do
expect(response.code).to eql("200")
expect(response.body).to match("Jekyll Admin")
Expand All @@ -44,14 +43,14 @@
context "API" do
let(:path) { "/_api" }

it "serves the Jekyll site", :skip => skip_condition do
it "serves the Jekyll site", :skip => skip_integration_condition do
expect(response.code).to eql("200")
expect(response.body).to match("collections_api")
end
end

context "watching" do
it "Jekyll isn't watching", :skip => skip_condition do
it "Jekyll isn't watching", :skip => skip_integration_condition do
File.open(File.join(source, "page.md"), "a") do |f|
f.puts "peek-a-boo"
end
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def write_file(path, content = "---\n---\n\n# test")
path
end

def skip_integration_condition
Gem.win_platform? || ENV["CI"]
end

RSpec::Matchers.define :be_an_existing_file do
match do |path|
path = in_source_dir(path)
Expand Down

0 comments on commit 0843a63

Please sign in to comment.