Skip to content

Commit

Permalink
Merge pull request #1 from bmjen/jbondpdx-string-edits
Browse files Browse the repository at this point in the history
(fixup) Updates spec tests to reflect updated strings.
  • Loading branch information
Jean B committed Aug 30, 2017
2 parents 5d4b3cc + e2bc548 commit bf2c922
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion spec/unit/cli/validate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
let(:validator) { PDK::Validate::PuppetValidator }

it 'warns about unknown validators, invokes known validators, and exits zero' do
expect(logger).to receive(:warn).with("Unknown validator 'bad-val'. Available validators: #{validator_names}")
expect(logger).to receive(:warn).with(%r{Unknown validator 'bad-val'. Available validators: #{validator_names}}i)
expect(validator).to receive(:invoke).with(report, {}).and_return(0)

expect {
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pdk/answer_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
it 'raises a FatalError if not passed a Hash' do
expect {
answer_file.update!('an answer without a question')
}.to raise_error(PDK::CLI::FatalError, %r{answer file can only be updated with a hash}i)
}.to raise_error(PDK::CLI::FatalError, %r{answer file can be updated only with a hash}i)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pdk/cli/new/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

it 'exits with a fatal error' do
expect(logger).to receive(:fatal).with(a_string_matching(%r{must be run from inside a module}))
expect(logger).to receive(:fatal).with(a_string_matching(%r{must be run from inside a valid module}))

expect {
PDK::CLI.run(%w[new class test_class])
Expand Down
16 changes: 8 additions & 8 deletions spec/unit/pdk/generate/module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
it 'uses that template to generate the module' do
expect(PDK::Module::TemplateDir).to receive(:new).with('cli-template', anything).and_yield(test_template_dir)
expect(logger).to receive(:info).with(a_string_matching(%r{generated at path}i))
expect(logger).to receive(:info).with(a_string_matching(%r{In your new module directory, add classes with the 'pdk new class' command}i))
expect(logger).to receive(:info).with(a_string_matching(%r{In your module directory, add classes with the 'pdk new class' command}i))

described_class.invoke(invoke_opts.merge(:'template-url' => 'cli-template'))
end
Expand Down Expand Up @@ -198,7 +198,7 @@
PDK.answers.update!('template-url' => 'answer-template')
expect(PDK::Module::TemplateDir).to receive(:new).with('answer-template', anything).and_yield(test_template_dir)
expect(logger).to receive(:info).with(a_string_matching(%r{generated at path}i))
expect(logger).to receive(:info).with(a_string_matching(%r{In your new module directory, add classes with the 'pdk new class' command}i))
expect(logger).to receive(:info).with(a_string_matching(%r{In your module directory, add classes with the 'pdk new class' command}i))

described_class.invoke(invoke_opts)
end
Expand Down Expand Up @@ -241,7 +241,7 @@
end

subject(:answers) do
allow($stdout).to receive(:puts).with(a_string_matching(%r{quick questions}))
allow($stdout).to receive(:puts).with(a_string_matching(%r{questions}))
interview_metadata
PDK.answers
end
Expand Down Expand Up @@ -275,7 +275,7 @@
end

it 'populates the Metadata object based on user input' do
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 quick questions}m))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 questions}m))

expect(interview_metadata).to include(
'name' => 'foo-bar',
Expand Down Expand Up @@ -329,7 +329,7 @@
end

it 'populates the interview question defaults with existing metadata values' do
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 quick questions}))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 questions}))

expect(interview_metadata).to include(
'name' => 'defaultauthor-bar',
Expand Down Expand Up @@ -372,7 +372,7 @@
end

it 'populates the Metadata object based on user input' do
allow($stdout).to receive(:puts).with(a_string_matching(%r{7 quick questions}m))
allow($stdout).to receive(:puts).with(a_string_matching(%r{7 questions}m))

expect(interview_metadata).to include(
'name' => 'foo-bar',
Expand Down Expand Up @@ -408,7 +408,7 @@

it 'exits cleanly' do
allow(logger).to receive(:info).with(a_string_matching(%r{interview cancelled}i))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 quick questions}m))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 questions}m))

expect { interview_metadata }.to raise_error(SystemExit) { |error|
expect(error.status).to eq(0)
Expand All @@ -435,7 +435,7 @@

it 'exits cleanly' do
allow(logger).to receive(:info).with(a_string_matching(%r{module not generated}i))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 quick questions}m))
allow($stdout).to receive(:puts).with(a_string_matching(%r{8 questions}m))

expect { interview_metadata }.to raise_error(SystemExit) { |error|
expect(error.status).to eq(0)
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/pdk/module/metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
end

it 'errors when the provided name is not namespaced' do
expect { metadata.update!('name' => 'foo') }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the field must be a dash-separated username and module name")
expect { metadata.update!('name' => 'foo') }.to raise_error(ArgumentError, %r{Invalid 'name' field in metadata.json: field must be a dash-separated user name and module name}i)
end

it 'errors when the provided name contains non-alphanumeric characters' do
expect { metadata.update!('name' => 'foo-@bar') }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the module name contains non-alphanumeric (or underscore) characters")
expect { metadata.update!('name' => 'foo-@bar') }.to raise_error(ArgumentError, %r{Invalid 'name' field in metadata.json: module name must contain only alphanumeric or underscore characters}i)
end

it 'errors when the provided name starts with a non-letter character' do
expect { metadata.update!('name' => 'foo-1bar') }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the module name must begin with a letter")
expect { metadata.update!('name' => 'foo-1bar') }.to raise_error(ArgumentError, %r{Invalid 'name' field in metadata.json: module name must begin with a letter}i)
end
end
end
26 changes: 13 additions & 13 deletions spec/unit/pdk/report/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{file not specified})
expect { event }.to raise_error(ArgumentError, %r{file not specified}i)
end
end

Expand All @@ -68,7 +68,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{file not specified})
expect { event }.to raise_error(ArgumentError, %r{file not specified}i)
end
end

Expand All @@ -80,7 +80,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{source not specified})
expect { event }.to raise_error(ArgumentError, %r{source not specified}i)
end
end

Expand All @@ -92,7 +92,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{source not specified})
expect { event }.to raise_error(ArgumentError, %r{source not specified}i)
end
end

Expand All @@ -104,7 +104,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{state not specified})
expect { event }.to raise_error(ArgumentError, %r{state not specified}i)
end
end

Expand All @@ -116,7 +116,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{state not specified})
expect { event }.to raise_error(ArgumentError, %r{state not specified}i)
end
end

Expand Down Expand Up @@ -159,7 +159,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{state must be a Symbol})
expect { event }.to raise_error(ArgumentError, %r{state must be a Symbol}i)
end
end

Expand All @@ -171,7 +171,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{Invalid state :maybe})
expect { event }.to raise_error(ArgumentError, %r{Invalid state :maybe}i)
end
end

Expand Down Expand Up @@ -211,7 +211,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{only contain the digits 0-9})
expect { event }.to raise_error(ArgumentError, %r{contain only the digits 0-9}i)
end
end

Expand All @@ -223,7 +223,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{must be an Integer or a String})
expect { event }.to raise_error(ArgumentError, %r{must be an Integer or a String}i)
end
end

Expand Down Expand Up @@ -279,7 +279,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{only contain the digits 0-9})
expect { event }.to raise_error(ArgumentError, %r{contain only the digits 0-9}i)
end
end

Expand All @@ -291,7 +291,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{must be an Integer or a String})
expect { event }.to raise_error(ArgumentError, %r{must be an Integer or a String}i)
end
end

Expand Down Expand Up @@ -319,7 +319,7 @@
end

it 'raises an ArgumentError' do
expect { event }.to raise_error(ArgumentError, %r{trace must be an Array})
expect { event }.to raise_error(ArgumentError, %r{trace must be an Array}i)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/pdk/util_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
it 'raises a FatalError' do
expect {
described_class.pdk_package_basedir
}.to raise_error(PDK::CLI::FatalError, 'Package basedir requested for non-package install')
}.to raise_error(PDK::CLI::FatalError, %r{Package basedir requested for non-package install}i)
end
end

Expand All @@ -181,7 +181,7 @@
it 'raises a FatalError' do
expect {
described_class.package_cachedir
}.to raise_error(PDK::CLI::FatalError, 'Package basedir requested for non-package install')
}.to raise_error(PDK::CLI::FatalError, %r{Package basedir requested for non-package install}i)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/pdk/validate/metadata_syntax_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
source: 'metadata-syntax',
state: :failure,
severity: 'error',
message: 'could not be read',
message: 'Could not be read.',
)
expect(return_value).to eq(1)
end
Expand Down

0 comments on commit bf2c922

Please sign in to comment.