Authentication is a special part of web applications. On the one hand, it usually is a crucial security mechanism restrict access to certain people and roles. On the other hand, most users authenticate only once, so it is very unlikely to spot issues by accident.
So, here comes a quick checklist to help you verifying your authentication solution is all set.
Invalid forms now re-render with a HTTP status
422 Unprocessable Entity.
This helps with.
When writing a Sass function, you may run into an error message that may be confusing:
@function rules may not contain style rules.
What Sass is trying to tell you is that a line in your Sass function is computing a result that is neither assigned to a variable nor returned.
Keep in mind that all functions in Sass return something, Sass does not mutate objects.
In Chrome DevTools in the Sources tab you can active Event Listener Breakpoints for debugging events.
The Event Listener Breakpoints in the Chrome DevTools can be quiet useful for debugging why and where code is handling specific events.
Here you can see a very simple example that shows what lines of code handle a click:
You can use thisif you want to try it yourself.
Updated the card as we found a second way how you can shoot yourself in the foot with nested transaction.
In Chrome DevTools in the Elements tab or in Firefox in the Inspector tab you can right click on an element and choose Break on to debug changes related to this element.
Simply add this to your
If you are on rspec >= 3 and use a
rails_helper.rb require this instead of the
If you are using
parallel_tests and this is not working for you,
.rspec might be ignored. Try using a
To safely transport an arbitrary string within a URL, you need to
If you are using Rails URL helpers like
movies_path(:query => ARBITRARY_STRING_HERE), Rails will take care of the encoding for you. If you are building URLs manually, you need to follow this guide.
In Ruby, use
CGI.escape('foo=foo&bar=bar') => "foo%3Dfoo%26bar%3Dbar"
Do not ever use
URI.encode or ...
In a nutshell: Do not use
Modern capybara will also bring
evaluate_async_script. For details, see here.
While you can use both, the first line (with
evaluate_script) might freeze your browser window for 10 seconds.
The reason is that `...
Git allows you to set push options when pushing a branch to the remote.
You can use this to build an alias that automatically pushes a branch and creates a merge request for it.
Put this in your
~/.gitconfig in the
mr = push origin HEAD -o merge_request.create -o merge_request.draft
Now you can do
git mr and a draft merge request will be created.
Target branch is your project's default branch, i.e.
To specify a different target branch, add
Added a section
Further readings for related cards and put a recent card to that section.
In the Elements tab in the Chrome DevTools you can right click on an element and select Store as global variable.
Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.
Given you are currently on your branch's HEAD that is not working as expected, an example workflow could be:
git bisect start # Start bisecting git bisect bad # Tag the revision you are currently on (HEAD) as bad. You could also pass a commit's SHA1 like below: git bisect good abcdef12345678 # Give the SHA1 of any commit that was working as it should # shorthand: git bisect start <bad ref> <good ref>
Git will fetch a comm...
As your Rails project grows, you will accumulate a number of small patches. These will usually fix a bug in a gem, or add a method to core classes.
Instead of putting many files into
config/initializers, I recommend to group them by gem in
lib/ ext/ factory_girl/ mixin.rb carrierwave/ change_storage.rb fix_cache_ids.rb sanitize_filename_characters.rb ruby/ range/ covers_range.rb array/ dump_to_excel.rb xss_aware_join.rb enumerable/ ...
can automatically save screenshots and the HTML for failed Capybara tests in Cucumber, RSpec or Minitest.
Requires Capybara-Webkit, Selenium or poltergeist for making screenshots. They're saved into
The attached files contain config for cucumber integration and a
Then show me a screenshot step.
If your project uses , you can use its
Then show me the page step instead.
ActiveType::Object inherits from
ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database persistence.
If you have a class which inherits from
ActiveType::Object and you need to override the
#initialize method, then you should be really careful:
ActiveRecod::Baseobjects really want to get their arguments processable as keyword arguments. Don't change the syntax, or y...
If you're experiencing that your bundle install command fails with an error message like this, rubygems.org might have issues with their ipv6 connectivity:
$ bundle install Fetching source index from https://rubygems.org/ Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>
If that's actually the case, then you can try to deprioritize the ipv...