Skip to content

Commit

Permalink
Merge pull request #20 from formigarafa/gh-action-for-tests
Browse files Browse the repository at this point in the history
Create tests.yml
  • Loading branch information
formigarafa authored Jan 4, 2025
2 parents 8b62582 + a8006b8 commit 8c73fc6
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 34 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ['3.4', '3.3', '3.2', '2.7']

steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
run: bundle exec rake
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source "https://rubygems.org"
gemspec

group :development do
gem "mini_racer", "~> 0.16"
gem "mini_racer", "~> 0.6"
gem "rake", "~> 13.2"
gem "rspec", "~> 3.13"
gem "rubocop", "~> 1.68"
Expand Down
42 changes: 22 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ GEM
ast (2.4.2)
diff-lcs (1.5.1)
docile (1.4.1)
json (2.7.6)
json (2.9.1)
language_server-protocol (3.17.0.3)
libv8-node (18.19.0.0)
libv8-node (18.19.0.0-aarch64-linux)
libv8-node (18.19.0.0-aarch64-linux-musl)
libv8-node (18.19.0.0-arm64-darwin)
libv8-node (18.19.0.0-x86_64-darwin)
libv8-node (18.19.0.0-x86_64-linux)
libv8-node (18.19.0.0-x86_64-linux-musl)
mini_racer (0.16.0)
libv8-node (~> 18.19.0.0)
libv8-node (16.19.0.1)
libv8-node (16.19.0.1-aarch64-linux)
libv8-node (16.19.0.1-aarch64-linux-musl)
libv8-node (16.19.0.1-arm64-darwin)
libv8-node (16.19.0.1-x86_64-darwin)
libv8-node (16.19.0.1-x86_64-linux)
libv8-node (16.19.0.1-x86_64-linux-musl)
mini_racer (0.6.4)
libv8-node (~> 16.19.0.0)
parallel (1.26.3)
parser (3.3.5.1)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
regexp_parser (2.10.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
Expand All @@ -41,17 +41,17 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.68.0)
rubocop (1.69.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.34.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
simplecov (0.22.0)
Expand All @@ -60,7 +60,9 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
unicode-display_width (2.6.0)
unicode-display_width (3.1.3)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)

PLATFORMS
aarch64-linux
Expand All @@ -72,12 +74,12 @@ PLATFORMS
x86_64-linux-musl

DEPENDENCIES
mini_racer (~> 0.16)
mini_racer (~> 0.6)
rake (~> 13.2)
rspec (~> 3.13)
rubocop (~> 1.68)
simplecov (~> 0.22)
zxcvbn!

BUNDLED WITH
2.5.22
2.3.27
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Zxcvbn

[![Gem Version](https://badge.fury.io/rb/zxcvbn.svg)](https://badge.fury.io/rb/zxcvbn)
[![Build Status](https://travis-ci.com/formigarafa/zxcvbn-rb.svg?branch=master)](https://travis-ci.com/formigarafa/zxcvbn-rb)
[![Build Status](https://github.com/formigarafa/zxcvbn-rb/actions/workflows/tests.yml/badge.svg)](https://github.com/formigarafa/zxcvbn-rb)

Ruby port of Dropbox's [zxcvbn.js](https://github.com/dropbox/zxcvbn) JavaScript library running completely in Ruby (no need to load execjs or libv8).

Expand Down
3 changes: 1 addition & 2 deletions spec/support/js_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require "mini_racer"
require "json"
require "digest"
require "base64"

module JsHelpers
def js_ctx
Expand Down Expand Up @@ -38,7 +37,7 @@ def js_estimate_guesses(match, password)
end

def cached_eval(js_str)
tmp_hash = Base64.urlsafe_encode64 Digest::MD5.digest(js_str.to_s), padding: false
tmp_hash = Digest::MD5.hexdigest(js_str.to_s)
cache_name = Pathname(File.expand_path("../../../tmp/#{tmp_hash}.json", __FILE__))
if File.exist?(cache_name)
JSON.parse(File.read(cache_name))
Expand Down

0 comments on commit 8c73fc6

Please sign in to comment.