1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

sqlite dependency; specs and formatting issue

This commit is contained in:
Bryan Hanks, PMP 2021-03-02 08:47:44 -06:00
parent 9ae56ba413
commit 96421a266a
4 changed files with 18 additions and 18 deletions

View file

@ -1,5 +1,5 @@
## master (unreleased)
- Fixes struct formatting [@randyjap] - [#361]
## 1.9.2
- Tests work with Ruby 2.6.6, 2.7.2 and 3.0.0

View file

@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec', '>= 3.0.0'
s.add_development_dependency 'appraisal'
s.add_development_dependency 'fakefs', '>= 0.2.1'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'sqlite3', '~> 1.3.6'
s.add_development_dependency 'nokogiri', '>= 1.11.0'
# s.add_development_dependency 'simplecov'
# s.add_development_dependency 'codeclimate-test-reporter'

View file

@ -15,7 +15,7 @@ module AwesomePrint
def format
vars = variables.map do |var|
property = var.to_s[1..-1].to_sym # to_s because of some monkey patching done by Puppet.
property = var.to_s.to_sym # to_s because of some monkey patching done by Puppet.
accessor = if struct.respond_to?(:"#{property}=")
struct.respond_to?(property) ? :accessor : :writer
else

View file

@ -604,44 +604,44 @@ EOS
it 'plain multiline' do
s1 = <<-EOS.strip
address = \"1313 Mockingbird Lane\",
name = \"Herman Munster\"
attr_accessor :address = \"1313 Mockingbird Lane\",
attr_accessor :name = \"Herman Munster\"
EOS
s2 = <<-EOS.strip
name = \"Herman Munster\",
address = \"1313 Mockingbird Lane\"
attr_accessor :name = \"Herman Munster\",
attr_accessor :address = \"1313 Mockingbird Lane\"
EOS
expect(@struct.ai(plain: true)).to satisfy { |out| out.match(s1) || out.match(s2) }
end
it 'plain multiline indented' do
s1 = <<-EOS.strip
address = "1313 Mockingbird Lane",
name = "Herman Munster"
attr_accessor :address = "1313 Mockingbird Lane",
attr_accessor :name = "Herman Munster"
EOS
s2 = <<-EOS.strip
name = "Herman Munster",
address = "1313 Mockingbird Lane"
attr_accessor :name = "Herman Munster",
attr_accessor :address = "1313 Mockingbird Lane"
EOS
expect(@struct.ai(plain: true, indent: 1)).to satisfy { |out| out.match(s1) || out.match(s2) }
end
it 'plain single line' do
s1 = 'address = "1313 Mockingbird Lane", name = "Herman Munster"'
s2 = 'name = "Herman Munster", address = "1313 Mockingbird Lane"'
s1 = 'attr_accessor :ddress = "1313 Mockingbird Lane", attr_accessor :name = "Herman Munster"'
s2 = 'attr_accessor :name = "Herman Munster", attr_accessor :address = "1313 Mockingbird Lane"'
expect(@struct.ai(plain: true, multiline: false)).to satisfy { |out| out.match(s1) || out.match(s2) }
end
it 'colored multiline (default)' do
s1 = <<-EOS.strip
address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m,
name\e[0;37m = \e[0m\e[0;33m\"Herman Munster\"\e[0m
\e[1;36mattr_accessor\e[0m \e[0;35m:address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m,
\e[1;36mattr_accessor\e[0m \e[0;35m:name\e[0;37m = \e[0m\e[0;33m\"Herman Munster\"\e[0m
EOS
s2 = <<-EOS.strip
name\e[0;37m = \e[0m\e[0;33m\"Herman Munster\"\e[0m,
address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m
\e[1;36mattr_accessor\e[0m \e[0;35m:name\e[0;37m = \e[0m\e[0;33m\"Herman\e[1;36mattr_accessor\e[0m \e[0;35m: Munster\"\e[0m,
\e[1;36mattr_accessor\e[0m \e[0;35m:address\e[0;37m = \e[0m\e[0;33m\"1313 Mockingbird Lane\"\e[0m
EOS
expect(@struct.ai).to satisfy { |out| out.include?(s1) || out.include?(s2) }
expect(@struct.ai).to satisfy { |out| out.include?(s1) && out.include?(s2) }
end
end