This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test| # frozen_string_literal: true | |
| require_relative '../system/my_app/container' | |
| module MyApp | |
| module Tests | |
| class Container < Dry::System::Container | |
| use :env, inferrer: -> { 'test' } | |
| configure do |
| module Commands | |
| module Meeting | |
| AcceptSchema = Dry::Validation.Schema do | |
| required(:user_id).filled | |
| required(:status).value(eql?: :scheduled) | |
| end | |
| class Accept < Command | |
| def call | |
| return validate if validate.failure? |
This gist will collects all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test| #!/usr/bin/env bash | |
| # Author: Sasha Nikiforov | |
| # source of inspiration | |
| # https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions | |
| # Detect platform | |
| if [ "$(uname)" == "Darwin" ]; then | |
| # MacOS |
| class Service | |
| class TransactionWrapper | |
| TransactionFailed = Class.new(StandardError) | |
| attr_reader :sequence | |
| delegate :append, :prepend, to: :sequence | |
| def initialize(sequence, connection) | |
| @sequence = sequence | |
| @connection = connection |
| { | |
| "name": "Root", | |
| "children": [ | |
| { | |
| "name": "Branch 1", | |
| "children": [ | |
| {"name": "Leaf 3"}, | |
| {"name": "Leaf 4"} | |
| ] | |
| }, |
| require('config/adapters/faye-adapter'); | |
| export default DS.FayeAdapter.extend(); |
| # Useage: select2("value to select", from: "label text") | |
| module Capybara | |
| module Select2 | |
| def select2(value, options={}) | |
| select_name = options[:from] | |
| select2_container = first("label", text: select_name).find(:xpath, "..").find(".select2-container") | |
| select2_container.find(".select2-choice").click | |
| find(:xpath, "//body").find(".select2-drop li", text: value).click | |
| end |
| require "spec_helper" | |
| describe ExampleController do | |
| context "GET #index" do | |
| let(:resources) { FactoryGirl.create_list(:resource) } | |
| before do | |
| get :index | |
| end |