summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2017-09-24 22:57:46 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2017-09-25 06:51:00 -0300
commit56b7182d6f57b007759b3444130c67858b155164 (patch)
tree95b8308c55d3a310b2db3fb9472f1e66f95b894e /test
parente4aef4f20a2cab1f471eca70bb5fa52ffadebfe7 (diff)
downloadhighline-56b7182d6f57b007759b3444130c67858b155164.tar.gz
Fix class/module nesting
Diffstat (limited to 'test')
-rw-r--r--test/acceptance/acceptance_test.rb104
1 files changed, 53 insertions, 51 deletions
diff --git a/test/acceptance/acceptance_test.rb b/test/acceptance/acceptance_test.rb
index 6d56195..b77e56d 100644
--- a/test/acceptance/acceptance_test.rb
+++ b/test/acceptance/acceptance_test.rb
@@ -2,68 +2,70 @@
require "highline/import"
-class HighLine::AcceptanceTest
- @answers ||= {}
+class HighLine
+ class AcceptanceTest
+ @answers ||= {}
- class << self
- attr_reader :answers
- end
+ class << self
+ attr_reader :answers
+ end
- def self.check
- caller_file = File.basename(caller(1..1).first.split(":")[-3])
+ def self.check
+ caller_file = File.basename(caller(1..1).first.split(":")[-3])
- test = new
- yield test
- test.caller_file = caller_file
- test.check
- end
+ test = new
+ yield test
+ test.caller_file = caller_file
+ test.check
+ end
- def self.answers_for_report
- answers.map do |file, answer|
- "#{file}: #{answer}"
- end.join("\n")
- end
+ def self.answers_for_report
+ answers.map do |file, answer|
+ "#{file}: #{answer}"
+ end.join("\n")
+ end
- # A test description to be shown to user.
- # It should express what the user is
- # expected to check.
- attr_accessor :desc
+ # A test description to be shown to user.
+ # It should express what the user is
+ # expected to check.
+ attr_accessor :desc
- # A test action to be checked by the user
- attr_accessor :action
+ # A test action to be checked by the user
+ attr_accessor :action
- # A text asking the confirmation if
- # the action worked (y) or not (n).
- attr_accessor :question
+ # A text asking the confirmation if
+ # the action worked (y) or not (n).
+ attr_accessor :question
- # Automatically filled attribute pointing
- # to the file where the current test
- # source is located. So we could check
- # at the report what tests passed or failed.
- attr_accessor :caller_file
+ # Automatically filled attribute pointing
+ # to the file where the current test
+ # source is located. So we could check
+ # at the report what tests passed or failed.
+ attr_accessor :caller_file
- def check
- # Print a header with the test description
- puts "====="
- puts " #{caller_file}"
- puts "====="
- puts
- puts desc
+ def check
+ # Print a header with the test description
+ puts "====="
+ puts " #{caller_file}"
+ puts "====="
+ puts
+ puts desc
- # Execute the proc/lambda assigned to action
- puts "---"
- puts
- action.call
- puts
- puts "---"
- puts
+ # Execute the proc/lambda assigned to action
+ puts "---"
+ puts
+ action.call
+ puts
+ puts "---"
+ puts
- # Gather the user feedback about the test
- print question
- answer = STDIN.gets.chomp
- answer = "y" if answer.empty?
- HighLine::AcceptanceTest.answers[caller_file] = answer
+ # Gather the user feedback about the test
+ print question
+ answer = STDIN.gets.chomp
+ answer = "y" if answer.empty?
+ HighLine::AcceptanceTest.answers[caller_file] = answer
- puts
+ puts
+ end
end
end