Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

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

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rake test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/coverage/
/.bundle/
/vendor/bundle/
*.gem
.rspec_status
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.libs << 'lib'
t.test_files = FileList['test/**/test_*.rb'].exclude('test/test_helper.rb')
t.verbose = true
end

task default: :test
23 changes: 23 additions & 0 deletions test/faker/test_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require_relative '../test_helper'

class TestFakerVersion < Test::Unit::TestCase
def test_version_is_defined
assert defined?(Faker::VERSION)
end

def test_version_is_a_string
assert_instance_of String, Faker::VERSION
end

def test_version_matches_semver_format
assert_match(/\A\d+\.\d+\.\d+\z/, Faker::VERSION)
end

def test_version_matches_gemspec
gemspec_path = File.expand_path('../../faker.gemspec', __dir__)
spec = Gem::Specification.load(gemspec_path)
assert_equal spec.version.to_s, Faker::VERSION
end
end
13 changes: 13 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'simplecov'

SimpleCov.start do
add_filter ['.bundle', 'lib/extensions', 'test']
end

require 'minitest/autorun'
require 'test/unit'
require 'rubygems'

require File.expand_path("#{File.dirname(__FILE__)}/../lib/faker/version")