File: ruby-beautify_spec.rb

package info (click to toggle)
ruby-beautify 0.97.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 340 kB
  • sloc: ruby: 628; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 984 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'spec_helper.rb'

# unit tests suck.  But I do want to make sure this one function behaves as expected.
# it simplifies the rest of the testing process (by not requiring multiple passes of each scenario).
describe "Ruby Beautify Library" do
	before :all do
		@ugly_string = File.open('spec/usage_scenarios/pre_indented.rb').read
		@pretty_string = File.open('spec/usage_scenarios/pre_indented_pretty.rb').read
		@pretty_string_tabs = @pretty_string.gsub("\t", "\t\t")
		@pretty_string_space = File.open('spec/usage_scenarios/pre_indented_pretty_space.rb').read
	end

	describe "#pretty_string" do
		it "will indent by tab ( by default )" do
			expect(RubyBeautify.pretty_string(@ugly_string)).to eq @pretty_string
		end
		it "will indent by space" do
			expect(RubyBeautify.pretty_string(@ugly_string, indent_token:' ')).to eq @pretty_string_space
		end
		it "will honor indent count" do
			expect(RubyBeautify.pretty_string(@ugly_string)).to eq @pretty_string
		end
	end
end