Skip to content

Instantly share code, notes, and snippets.

View kaspernj's full-sized avatar

Kasper Stöckel kaspernj

  • Germany
View GitHub Profile
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '6.1.1' # use correct rails version
@kaspernj
kaspernj / stub_original_method_with_sleep.rb
Created April 18, 2020 17:43
Stubbing original method with sleep
expect(object).to receive(:method_name).and_wrap_original do |original, *args, &blk|
sleep 1
original.call(*args, &blk)
end
class ScssLintConfigGenerator < ApplicationService
def execute
output = %x[scss-lint]
todo_config = {
"linters" => {}
}
output.scan(/^(. ):(\d ):(\d ) \[(.)\] (. ?): (. )$/) do |match|
file_path, line, column, offence_type, linter_name, description = match
file = "/#{file_path}"