Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Corey Hemminger <hemminger@hotmail.com>
  • Loading branch information
Stromweld committed Jun 18, 2024
1 parent a9af252 commit b79da91
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ source "https://rubygems.org"

gemspec

group :test do
gem 'bundler'

Check failure on line 8 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
gem 'rake'

Check failure on line 9 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
gem 'rspec', '>= 3.2'

Check failure on line 10 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check failure on line 10 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
end

group :chefstyle do
gem "chefstyle", "2.2.3"
gem 'chefstyle', '>= 2.2.3'

Check failure on line 14 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check failure on line 14 in Gemfile

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
end
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

begin
require "chefstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new(:style) do |task|
task.options += ["--display-cop-names", "--no-color"]
end
rescue LoadError
puts "chefstyle is not available. (sudo) gem install chefstyle to do style checking."
end

RSpec::Core::RakeTask.new(:test)

task default: %i{test style}
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
29 changes: 29 additions & 0 deletions spec/version_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Encoding: UTF-8

Check failure on line 1 in spec/version_spec.rb

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/Encoding: Unnecessary utf-8 encoding comment.

#
# Authors:: Chef Partner Engineering (<partnereng@chef.io>)
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'spec_helper'

Check failure on line 20 in spec/version_spec.rb

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
require 'kitchen/driver/version'

Check failure on line 21 in spec/version_spec.rb

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

describe Kitchen::Driver::WORKFLOW_TESTING_VERSION do
let(:expected_version) { '1.0.0' } # replace with your expected version

Check failure on line 24 in spec/version_spec.rb

View workflow job for this annotation

GitHub Actions / lint-unit / Chefstyle on Ruby 3.3

[Correctable] Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

it 'has the correct version' do
expect(Kitchen::Driver::WORKFLOW_TESTING_VERSION::STRING).to eq(expected_version)
end
end

0 comments on commit b79da91

Please sign in to comment.