Skip to content

Instantly share code, notes, and snippets.

@gunesmes
Last active May 2, 2020 22:32
Show Gist options
  • Save gunesmes/524d8d8580e8d6f965a02ca62b44d420 to your computer and use it in GitHub Desktop.
Save gunesmes/524d8d8580e8d6f965a02ca62b44d420 to your computer and use it in GitHub Desktop.
name: Ruby
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
with:
ruby-version: 2.6
- name: Install dependencies
run: bundle install
- name: Run Rspec Tests
run: |
cd src/test
rspec specs
# frozen_string_literal: true
require 'json'
RSpec.context 'File Format Check' do
describe 'terms.json' do
before(:context) do
file = File.open("#{File.dirname(__FILE__ )}/../../../terms.json")
@file_content = file.read
end
it "should be a valid json file" do
expect(valid_json?(@file_content)).to be true
end
it "each term should have `term` and `meaning`" do
expect(has_key_pairs?(@file_content)).to be true
end
it "should not have duplicated keys/terms" do
expect(has_duplicated_terms?(@file_content)).to be true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment