All Posts

Page 13 of 21

Running Bitbucket Pipelines builds with docker compose

As a companion to [my post describing how to run tests with docker-compose on Gitlab CI], I converted the build steps this morning to work with Bitbucket Pipelines. Here’s the adapted bitbucket-pipelines.yml file: image: docker:stable pipelines: default: - step: services: - docker script: - apk add --no-cache py-pip bash - pip install --no-cache-dir docker-compose - docker-compose -v - docker-compose run...

SASS Colour Functions

I’ve been implementing a style guide this week, and in particular have been trying to focus on creating clean, decoupled, and reusable components. Part of this effort has involved ensuring that all “global” settings that are represented in the style guide are contained in a single settings file. A perfect example of one of these settings is the colour palette....

Running Gitlab CI tests with docker compose

I’ve been working for some time to get Pawfit (my pet project, literally), continuously deploying. I’ve only recently added tests, so now that I have them, I want a green check each time I push. I run just about all my Rails apps now using Docker and docker-compose, almost always using my own base Docker* files. I choose not to...

TIL: Mocking with Minitest in Ruby 2.0+

I normally work within an RSpec testing envionment, but I definitely enjoy working with more traditional Test::Unit tests when I get the chance. Today I discovered that Minitest, the testing toolkit that has been part of the Ruby standard library since 2.0 has built-in support for mocks and stubs. To use this in a Test::Unit test, simply require "minitest/mocks". Mocking...

TIL: let! and before order is important

I’ve just come across this issue. It’s minor, but it tripped me up! In RSpec, there are three methods I find myself using all the time: before - this is equivalent to the setup method present in many assertion-based test frameworks, and runs before each test. let - this is a lazy-evaluated variable that will be made available to the...

TIL: Nested layouts in Rails

Nested layouts in Rails aren’t a technique that I’ve had to use a lot in the past, but I’m finding myself using them quite a bit in my current work. Nesting layouts allows for some sharing of a common view structure. The best example of this that I have come across is in the app I am working on. This...

TIL: Handling browser dialogs with headless Chrome in Capybara

My normal Rails 5.x development stack now uses Chrome, running headlessly, powered by the following gems: # Gemfile # ... gem 'capybara' gem 'chromedriver-helper' gem 'capybara-selenium' Unlike using things like Poltergeist, the only external dependency you need to run these tests is Chrome itself. If you wish to reduce your gem dependencies, you can also remove chromedriver-helper, but this will...

TIL: SASS @at root

The @at-root directive can be quite useful for creating SASS rules where you need to jump outside of a SASS scoping block back to the root level when your styles are compiled. In particular, this directive can be useful for generating BEM styles, since the & abbreviation continues to work for targeting the parent selector. Here’s an example of a...

TIL: before(:all) callbacks run outside the test transaction

While working on a feature test today, I learned that any database data that is modified in a before(:all) callback in an RSpec test is retained outside of the test run. This is documented quite clearly in the RSpec documentation, I just haven’t had the opportunity to work with these types of callbacks regularly before. The test I ran into...

TIL: text underline position

TIL about the CSS property text-underline-position. This property is a useful progressive enhancement to achieve a particular look and feel for links, in particular for content with many descenders. Examples: This is standard underlined text. This text has the underline position set to "under". This text has a bottom border instead of an underline. Notice that the border overflows the...

Page: 13 of 21