Skip to content

Commit 9cf23aa

Browse files
committed
test: add rspec test
* setup folders
1 parent 1535f9a commit 9cf23aa

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

locales/en.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
en:
22
vagrant_utm:
3+
config:
4+
utm_file_url_required: |-
5+
Configuration must specify utm.file_url.
6+
UTM file URL is required to import the UTM virtual machine.
37
errors:
48
utm_not_detected: |-
59
UTM Application not detected. Please install UTM from https://mac.getutm.app/

spec/spec_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# frozen_string_literal: true
22

3+
require "rspec"
4+
35
require "vagrant_utm"
6+
require "vagrant_utm/config"
47

58
RSpec.configure do |config|
69
# Enable flags like --only-failures and --next-failure
@@ -12,4 +15,7 @@
1215
config.expect_with :rspec do |c|
1316
c.syntax = :expect
1417
end
18+
19+
# Load the translations
20+
VagrantPlugins::Utm::Plugin.setup_i18n
1521
end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
RSpec.describe VagrantPlugins::Utm::Config do
4+
subject(:sut) { described_class.new }
5+
6+
context "defaults" do
7+
before { subject.finalize! }
8+
9+
it { expect(subject.check_guest_additions).to be(true) }
10+
it { expect(subject.name).to be_nil }
11+
end
12+
13+
describe "#validate" do
14+
it "raises an error if 'utm_file_url' has no value" do
15+
sut.utm_file_url = nil
16+
sut.name = "debian"
17+
sut.finalize!
18+
19+
result = sut.validate(nil)
20+
21+
expect(result["UTM Provider"].size).to eq(1)
22+
end
23+
end
24+
end

spec/vagrant_utm_spec.rb renamed to spec/vagrant_plugins/utm_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@
66
it "has a version number" do
77
expect(sut::VERSION).not_to be nil
88
end
9-
10-
it "does something useful" do
11-
expect(false).to eq(false)
12-
end
139
end

0 commit comments

Comments
 (0)