In FactoryBot factories, Rails' file_fixture is not available by default. To enable it, include a support module from rspec-rails: FactoryBot::SyntaxRunner.include(RSpec::Rails::FileFixtureSupport) That includes ActiveSupport::Testing...
...used (in development and tests)' do get 'http://www.example.com/test/set_cookie' response.headers['Set-Cookie'].should include('test=') # Cookie is still set response.headers['Set-Cookie'].should_not include('; Secure') end end
Consider the following example from the Modularity README: # app/models/article.rb class Article < ActiveRecord::Base include DoesStripFields[:name, :brand] end # app/models/shared/does_strip_fields.rb module DoesStripFields as_trait do |*fields| fields.each do |field|
...Modularity source code and understand how the implementation works. In particular, understand this syntax: include DoesStripFields[:name, :brand] What exactly is included here? How does Modularity enable parameterized modules? How...
...will fail when trying to compile their assets up front. class ApplicationController < ActionController::Base include EsbuildErrorRendering if Rails.env.development? end module ApplicationController::EsbuildErrorRendering ESBUILD_ERROR = Rails.root.join("esbuild_error_#{Rails.env}.txt") # see...
...have an indefinitely high resolution). When ordering lists by timestamps, you should therefore always include a final order condition using the primary key of the table. class Photo < ActiveRecord::Base...
...scope :by_date, -> { order('created_at DESC, id DESC') } end Photo.by_date Remember to include the id field in the database index...
...you need to skip those items that are #marked_for_destruction?. Otherwise you will include items that have been ticked for deletion in a nested form. See ActiveRecord: When aggregating...
...some benefits over placing fonts into your repo: All font weights and glyphs are included. You don't need to download and add files for latin, greek, cyrillic, or other...
...contain different unicode-range values which map different font files to the glyphs they include. This means that e.g. the file for cyrillic glyphs is only loaded when any text...
...Lockstep.synchronize end end Note that this method uses capybara-lockstep in the last line. Include this module in your test suite and call conclude_browser_requests at the end of...
...movie form, I should be able to select the inspiring movie. The list should: include all the movies that were released in previous years not include the movie itself
...include a movie that was itself inspired by the movie that is being edited. Traversal In the movie show view, I want to see the "inspiration tree" of that movie...
...you have the following code: module Mod def foo @@foo end end class Klass include Mod end @@foo does not mean Klass::@@foo (qualifier added to make my point; it...
...Ruby expression). It actually means Mod::@@foo and is shared between Mod, all classes including Mod as well as all their subclasses. Also note that only the class and module...
...makandra.de. 155 IN TXT "v=spf1 ip4:195.226.174.184 ip4:195.226.174.185 ip4:62.116.166.45 ip4:62.116.166.112 include:_spf.google.com include:_spf.makandra.de -all" Du weißt, was sich hinter "DNS Round Robin" verbirgt und was...
...them like this: *, :before, :after { transition-property: none !important; animation: none !important; } To only include these styles for tests, see Detect the current Rails environment from JavaScript or CSS.
...a list of acceptance criteria and (optionally) some additional notes. The introduction sentence should include the role of the user, what the user wants and why. The acceptance criteria are...
...your particular development server shows an error. Warning Unpoly cannot repeat form submissions that include file inputs. If it tries, the file data will be replaced with the string [object...
...To avoid confusion, this code will instead redirect to /__better_errors when a file is included in the submission. // Only do this in development. This requires a `[data-environment="development"]` attribute...
...See https://thepugautomatic.com/2013/07/dsom/ module WithModuleInheritance def with_module_inheritance(&block) anonymous_module = Module.new include anonymous_module anonymous_module.module_eval &block end end Module.include(WithModuleInheritance...
4 0 - 5 Dev machines are not blocked on test runs; Code Reviews include test badge; Automatically merge a PR on green tests Upgrade Rails 5 0 - 5
...client: Make a POST request with method override The default configuration Rails and Sinatra includes a Rack middleware that lets you control the HTTP method used for routing by POSTing...
...in an error like does not implement: current_power. The documentation on dynamic classes includes some ways to fix this by showing how dynamically defined attribute methods from ActiveRecord are...
...BS 2+3, but not above there are some forks which say that they include a BS4 renderer, but they didn't work for me. Suggestion: Remove simple-navigation and...
...or overwrite the styles by using bootstrap variables. Upgrade Phase 1 First you should include the new version into your project and replace the old imports, e.g. with webpack
...then((latitude) => { done(latitude) }) JS expect(returned_latitude).to eq latitude end When we include this step into a scenario and run it, it will fail because StreetMap is not...
...this for packages like jQuery. Otherwise the jQuery library attached to window might not include the functions of your packages that depend on jQuery. Note: This is only an issue...
...within the application. Background By default yarn will create a folder node_modules that includes all packages and their dependencies. In the example below we see two packages of jQuery...
...power that specifies which deals and documents are accessible by a user: class Power include Consul::Power power :deals do Deal.where(author_id: user.id) end power :documents do admin? ? Document.all...
...also need to override some methods, you can do this: class HelperProxy < ActionView::Base include ApplicationController.master_helper_module def current_user #let helpers act like we're a guest
Bare metal If you have strong nerves, you can also try to include the ApplicationController.master_helper_module directly into your model...
...config/application.rb config.action_controller.include_all_helpers = true If you cannot use this setting, your spec can include individual helper modules like this: describe 'some view', type: :view do helper SomeHelper helper OtherHelper...
render 'view_that_uses_helpers' end end Alternatively you can also explicitly include all helpers of a given controller like this: describe 'some view', type: :view do