aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-08 12:05:42 +0100
committerMarkus Reiter2017-02-10 17:19:19 +0100
commitdcb206dd1ef1be09f75774c0f86692ad3e31c679 (patch)
treead3c16267f82d37a068a9a5f504b851ee26a3e91 /Library
parent2ade29a5cf5df84ed9fb7dcf429c59c3e084a6a1 (diff)
downloadbrew-dcb206dd1ef1be09f75774c0f86692ad3e31c679.tar.bz2
Convert Create test to spec.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/spec/cask/cli/create_spec.rb (renamed from Library/Homebrew/cask/test/cask/cli/create_test.rb)28
1 files changed, 14 insertions, 14 deletions
diff --git a/Library/Homebrew/cask/test/cask/cli/create_test.rb b/Library/Homebrew/cask/spec/cask/cli/create_spec.rb
index f09c91e8e..e3d484d87 100644
--- a/Library/Homebrew/cask/test/cask/cli/create_test.rb
+++ b/Library/Homebrew/cask/spec/cask/cli/create_spec.rb
@@ -1,4 +1,4 @@
-require "test_helper"
+require "spec_helper"
# monkeypatch for testing
module Hbc
@@ -20,11 +20,11 @@ module Hbc
end
describe Hbc::CLI::Create do
- before do
+ before(:each) do
Hbc::CLI::Create.reset!
end
- after do
+ after(:each) do
%w[new-cask additional-cask another-cask yet-another-cask local-caff].each do |cask|
path = Hbc.path(cask)
path.delete if path.exist?
@@ -33,7 +33,7 @@ describe Hbc::CLI::Create do
it "opens the editor for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("new-cask")],
]
end
@@ -41,7 +41,7 @@ describe Hbc::CLI::Create do
it "drops a template down for the specified Cask" do
Hbc::CLI::Create.run("new-cask")
template = File.read(Hbc.path("new-cask"))
- template.must_equal <<-EOS.undent
+ expect(template).to eq <<-EOS.undent
cask 'new-cask' do
version ''
sha256 ''
@@ -57,44 +57,44 @@ describe Hbc::CLI::Create do
it "throws away additional Cask arguments and uses the first" do
Hbc::CLI::Create.run("additional-cask", "another-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("additional-cask")],
]
end
it "throws away stray options" do
Hbc::CLI::Create.run("--notavalidoption", "yet-another-cask")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("yet-another-cask")],
]
end
it "raises an exception when the Cask already exists" do
- lambda {
+ expect {
Hbc::CLI::Create.run("basic-cask")
- }.must_raise Hbc::CaskAlreadyCreatedError
+ }.to raise_error(Hbc::CaskAlreadyCreatedError)
end
it "allows creating Casks that are substrings of existing Casks" do
Hbc::CLI::Create.run("local-caff")
- Hbc::CLI::Create.editor_commands.must_equal [
+ expect(Hbc::CLI::Create.editor_commands).to eq [
[Hbc.path("local-caff")],
]
end
describe "when no Cask is specified" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Create.run
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
describe "when no Cask is specified, but an invalid option" do
it "raises an exception" do
- lambda {
+ expect {
Hbc::CLI::Create.run("--notavalidoption")
- }.must_raise Hbc::CaskUnspecifiedError
+ }.to raise_error(Hbc::CaskUnspecifiedError)
end
end
end