Browse files

Extract common input description tests out to a shared example

Change-Id: I09cb245727b9f3796a2e424859271c4d84f3f1bb
  • Loading branch information...
1 parent 820f85f commit 291db9155336c7feb267b31be0b99e5fa12bbaef @vito vito committed Dec 18, 2012
View
14 spec/support/common_input_examples.rb
@@ -0,0 +1,14 @@
+shared_examples_for 'inputs must have descriptions' do
+ describe 'inputs' do
+ subject { command.inputs }
+
+ it "is not missing any descriptions" do
+ subject.each do |_, attrs|
+ next if attrs[:hidden]
+
+ expect(attrs[:description]).to be
+ expect(attrs[:description].strip).to_not be_empty
+ end
+ end
+ end
+end
View
13 spec/vmc/cli/app/delete_spec.rb
@@ -27,18 +27,7 @@
it { expect(Mothership::Help.group(:apps, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- next if attrs[:hidden]
-
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/app/push_spec.rb
@@ -25,16 +25,7 @@
it { expect(Mothership::Help.group(:apps, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/app/rename_spec.rb
@@ -27,16 +27,7 @@
it { expect(Mothership::Help.group(:apps, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/organization/orgs_spec.rb
@@ -34,16 +34,7 @@
it { expect(Mothership::Help.group(:organizations)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
2 spec/vmc/cli/route/delete_route_spec.rb
@@ -25,6 +25,8 @@
it { expect(Mothership::Help.group(:routes)).to include(subject) }
end
+ include_examples 'inputs must have descriptions'
+
describe 'inputs' do
subject { command.inputs }
it { expect(subject[:route][:description]).to eq "Route to delete" }
View
11 spec/vmc/cli/service/bind_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:services, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
12 spec/vmc/cli/service/delete_spec.rb
@@ -10,17 +10,7 @@
it { expect(Mothership::Help.group(:services, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- next if attrs[:hidden]
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/service/rename_spec.rb
@@ -27,16 +27,7 @@
it { expect(Mothership::Help.group(:services, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/service/service_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:services)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/service/unbind_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:services, :manage)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/space/rename_spec.rb
@@ -28,16 +28,7 @@
it { expect(Mothership::Help.group(:spaces)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |input, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/space/spaces_spec.rb
@@ -35,16 +35,7 @@
it { expect(Mothership::Help.group(:spaces)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
View
11 spec/vmc/cli/start/info_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:start)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'flags' do
subject { command.flags }
View
11 spec/vmc/cli/start/login_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:start)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'flags' do
subject { command.flags }
View
15 spec/vmc/cli/start/register_spec.rb
@@ -10,16 +10,7 @@
it { expect(Mothership::Help.group(:start)).to include(subject) }
end
- describe 'inputs' do
- subject { command.inputs }
-
- it "is not missing any descriptions" do
- subject.each do |_, attrs|
- expect(attrs[:description]).to be
- expect(attrs[:description].strip).to_not be_empty
- end
- end
- end
+ include_examples 'inputs must have descriptions'
describe 'arguments' do
subject { command.arguments }
@@ -54,7 +45,7 @@
subject do
with_output_to output do
- VMC::CLI.start %W(register #{email} --password #{password} --verify #{verify_password} #{login ? '--login' : '--no-login'} #{force ? '--force' : '--no-force'} --debug)
+ VMC::CLI.start %W(register --email #{email} --password #{password} --verify #{verify_password} #{login ? '--login' : '--no-login'} #{force ? '--force' : '--no-force'} --debug)
end
end
@@ -70,7 +61,7 @@
it "doesn't print out the score" do
subject
- expect(out).not_to include "score"
+ expect(out).not_to include "strength"
end
it "doesn't log in or register" do

0 comments on commit 291db91

Please sign in to comment.