spec/apiary/cli_spec.rb in apiaryio-0.4.2 vs spec/apiary/cli_spec.rb in apiaryio-0.5.0
- old
+ new
@@ -1,40 +1,37 @@
require 'spec_helper'
describe Apiary::CLI do
-
# Don't let Thor fold or truncate lines
ENV['THOR_COLUMNS'] = '1000'
# The documentation that ought to match the code
- READMETEXT = open("README.md") {|f| f.read}
+ READMETEXT = open('README.md', &:read)
it 'has help' do
- help = open('|ruby bin/apiary help') {|f| f.read}
- expect(help).to include("Commands:")
+ help = open('|ruby bin/apiary help', &:read)
+ expect(help).to include('Commands:')
expect(help.lines.count).to be >= 5
end
it 'has README.md' do
- expect(READMETEXT).to include("apiary help")
+ expect(READMETEXT).to include('apiary help')
expect(READMETEXT.lines.count).to be >= 5
end
# Confirm that all subcommands are documented, verbatim
- ([""] + (open('|ruby bin/apiary help', 'r') {|f| f.readlines}
- .map {|l| /^ +apiary /.match(l)?l:nil}
- .map {|l| /^ *apiary help/.match(l)?nil:l}
+ ([''] + (open('|ruby bin/apiary help', 'r', &:readlines)
+ .map { |l| /^ +apiary / =~ l ? l : nil }
+ .map { |l| /^ *apiary help/ =~ l ? nil : l }
.compact
- .map {|l| /^ *apiary ([^ ]*)/.match(l)[1] + " " }
+ .map { |l| /^ *apiary ([^ ]*)/.match(l)[1] + ' ' }
)
).each do |cmd|
-
it "includes help #{cmd}in README.md" do
- helptext = open("|ruby bin/apiary help #{cmd}") {|f| f.read}
+ helptext = open("|ruby bin/apiary help #{cmd}", &:read)
expect(helptext).to include("apiary #{cmd.strip}")
expect(READMETEXT).to include("apiary #{cmd.strip}")
expect(READMETEXT).to include(helptext)
-
end
end
end