Skip to content

Commit

Permalink
Define helper methods in module
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Nov 25, 2023
1 parent 11bac49 commit 15afb43
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@

require "lrama"

module RspecHelper
def fixture_path(file_name)
File.expand_path("../fixtures/#{file_name}", __FILE__)
end

def sample_path(file_name)
File.expand_path("../../sample/#{file_name}", __FILE__)
end

def exe_path(file_name)
File.expand_path("../../exe/#{file_name}", __FILE__)
end

def windows?
return /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
end
end

RSpec.configure do |config|
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Expand All @@ -26,23 +44,9 @@
c.syntax = :expect
end

config.include(RspecHelper)

# Allow to limit the run of the specs
# NOTE: Please do not commit the filter option.
# config.filter_run_when_matching :focus
end

def fixture_path(file_name)
File.expand_path("../fixtures/#{file_name}", __FILE__)
end

def sample_path(file_name)
File.expand_path("../../sample/#{file_name}", __FILE__)
end

def exe_path(file_name)
File.expand_path("../../exe/#{file_name}", __FILE__)
end

def windows?
return /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
end

0 comments on commit 15afb43

Please sign in to comment.