File: usage_scenarios_spec.rb

package info (click to toggle)
ruby-beautify 0.97.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, forky, sid, trixie
  • size: 340 kB
  • sloc: ruby: 628; makefile: 8
file content (20 lines) | stat: -rw-r--r-- 660 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
require 'spec_helper.rb'

describe "Usage Scenarios" do
	files = Dir.glob("spec/usage_scenarios/*_pretty.rb")
	scenarios = files.map do |f|
		r = /.*\/(?<scenario>.*)_pretty.rb/.match(f)
		r['scenario'] ||= nil
	end

	scenarios.each do |scenario|
		it "will test: #{scenario}" do
			scenario_file = "spec/usage_scenarios/#{scenario}.rb"
			scenario_md5_sum = Digest::MD5.hexdigest RubyBeautify.pretty_string File.read scenario_file

			scenario_pretty_file = "spec/usage_scenarios/#{scenario}_pretty.rb"
			scenario_pretty_md5_sum = Digest::MD5.hexdigest File.read(scenario_pretty_file)
			expect(scenario_md5_sum).to eq scenario_pretty_md5_sum
		end
	end
end