spec/topic_spec.rb in howzit-2.1.10 vs spec/topic_spec.rb in howzit-2.1.12
- old
+ new
@@ -7,11 +7,11 @@
content = 'Test Content'
subject(:topic) { Howzit::Topic.new(title, content) }
describe '.new' do
it 'makes a new topic instance' do
- expect(topic).to be_a Howzit::Topic
+ expect(topic).to be_a described_class
end
it 'has the correct title' do
expect(topic.title).to eq title
end
it 'has the correct content' do
@@ -49,24 +49,28 @@
describe '.grep' do
it 'returns true for matching pattern in content' do
expect(topic.grep('prereq.*?ite')).to be_truthy
end
+
it 'returns true for matching pattern in title' do
expect(topic.grep('bal.*?na')).to be_truthy
end
+
it 'fails on bad pattern' do
expect(topic.grep('xxx+')).to_not be_truthy
end
end
describe '.run' do
Howzit.options[:default] = true
+
it 'shows prereq and postreq' do
expect { topic.run }.to output(/prerequisite/).to_stdout
expect { topic.run }.to output(/postrequisite/).to_stdout
end
+
it 'Copies to clipboard' do
expect {
ENV['RUBYOPT'] = '-W1'
Howzit.options[:log_level] = 0
topic.run
@@ -75,17 +79,20 @@
end
describe '.print_out' do
Howzit.options[:header_format] = :block
Howzit.options[:color] = false
+
it 'prints the topic title' do
- expect(topic.print_out({single: true, header: true}).join("\n").uncolor).to match(/▌Topic Balogna/)
+ expect(topic.print_out({ single: true, header: true }).join("\n").uncolor).to match(/▌Topic Balogna/)
end
+
it 'prints a task title' do
- expect(topic.print_out({single: true, header: true}).join("\n").uncolor).to match(/▶ Null Output/)
+ expect(topic.print_out({ single: true, header: true }).join("\n").uncolor).to match(/▶ Null Output/)
end
+
it 'prints task action with --show-code' do
Howzit.options[:show_all_code] = true
- expect(topic.print_out({single: true, header: true}).join("\n").uncolor).to match(/▶ ls -1/)
+ expect(topic.print_out({ single: true, header: true }).join("\n").uncolor).to match(/▶ ls -1/)
end
end
end