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
#!/bin/sh | |
# | |
# An example hook script to prepare the commit log message. | |
# Called by "git commit" with the name of the file that has the | |
# commit message, followed by the description of the commit | |
# message's source. The hook's purpose is to edit the commit | |
# message file. If the hook fails with a non-zero status, | |
# the commit is aborted. | |
# | |
# To enable this hook, rename this file to "prepare-commit-msg". |
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
RSpec::Matchers.define :use_before_action do |expected| | |
# @example | |
# expect { get :index }.to use_before_action(:authenticate_user!) | |
match do |actual| | |
expect(controller).to receive(expected).and_call_original | |
instance_exec &actual | |
described_class._process_action_callbacks.find do |callback| |
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 FactoryGirlHelpers | |
# extract subject attributes and produce factory object from them | |
# | |
# @example subject_factory(:build_stubbed) | |
# @example subject_factory(:create, :comment_reply) | |
def subject_factory(method, factory_name = nil) | |
changed_attrbiutes = subject.changed | |
attributes = subject.attributes.slice changed_attrbiutes |
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 LinkHelpers | |
# wrap condition falsy text into span with html options | |
def link_to_if_with_options(condition, name, options={}, html_options={}, &block) | |
_super = link_to_if condition, name, options, html_options, &block | |
if condition | |
_super | |
else | |
content_tag :span, _super, html_options | |
end |
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 HelperExamplesExtensions | |
# Copy of stub_template from view specs | |
# @see RSpec::Rails::ViewExampleGroup::ExampleMethods#stub_template | |
def stub_template(hash) | |
view.view_paths.unshift(ActionView::FixtureResolver.new(hash)) | |
end | |
end | |
RSpec.configure do |config| | |
config.include HelperExamplesExtensions, type: :helper |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.min.js" | |
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" | |
crossorigin="anonymous"></script> | |
<script | |
src="index.js"></script> | |
</head> |