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
#!/usr/bin/env python3 | |
# Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | |
import os | |
import socket | |
import struct | |
import sys | |
import traceback | |
# See com.intellij.idea.SocketLock for the server side of this interface. |
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
module SpecHelpers | |
# See more on this: https://github.com/vcr/vcr/issues/600 | |
module VCRHooks | |
# @return [Proc] registered proc | |
def register_vcr_hook(type, *args, &block) | |
check_hook_type_valid!(type) | |
# Do not use #hooks hash directly, VCR wrap block into FilteredHook struct | |
VCR.configuration.send(type, *args, &block); block |
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
# Gemfile | |
gem 'rspec-rails', require: false | |
# spec_helper.rb | |
# | |
# IMPORT ONLY FIXTURE-RELATED CODE FROM rspec-rails | |
# | |
require 'rspec/rails/adapters' |
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
# spec_helper.rb | |
require 'nokogiri' | |
require 'equivalent-xml/rspec_matchers' | |
RSpec.configure do |config| | |
# Should be used with be_equivalent_to provided by 'equivalent-xml' gem | |
# @see http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/Builder | |
# @see https://github.com/mbklein/equivalent-xml | |
def xml_document(&block) | |
Nokogiri::XML::Builder.new(&block).doc |
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
require 'bundler/gem_tasks' | |
require 'active_record' | |
# Temporary switch to blank rake app, extract required tasks and import them to | |
# current rake task. Skip seed loader here, as we do not need it for tests. | |
# More info on AR tasks import: @see https://gist.github.com/drogus/6087979 | |
def import_active_record_tasks(default_rake_app) | |
Rake.application = Rake::Application.new | |
Rake.application.rake_require('active_record/railties/databases') |
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
t = Time.local(2008, 9, 1, 10, 5, 0) | |
# Self-explained | |
Timecop.freeze(t) do | |
expect(Time.zone.now.sec).to eq 0 | |
end | |
# The same as above | |
Timecop.freeze(new_time) | |
expect(Time.zone.now.sec).to eq 0 |