dom_glancy 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -3
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +1 -2
  6. data/README.md +69 -2
  7. data/app/assets/javascripts/application.js +7 -1
  8. data/app/assets/stylesheets/dom_glancy.css +19 -3
  9. data/app/controllers/dom_glancy_controller.rb +15 -15
  10. data/app/views/dom_glancy/index.html.erb +15 -10
  11. data/app/views/dom_glancy/path_config.html.erb +3 -3
  12. data/app/views/dom_glancy/show.html.erb +4 -4
  13. data/app/views/layouts/dom_glancy.html.erb +7 -7
  14. data/dom_glancy.gemspec +2 -2
  15. data/lib/dom_glancy/analysis.rb +108 -108
  16. data/lib/dom_glancy/configuration.rb +22 -0
  17. data/lib/dom_glancy/dom_glancy.rb +110 -96
  18. data/lib/dom_glancy/engine.rb +4 -0
  19. data/lib/dom_glancy/locations.rb +10 -43
  20. data/lib/dom_glancy/svg.rb +45 -43
  21. data/lib/dom_glancy/version.rb +1 -1
  22. data/lib/dom_glancy.rb +5 -1
  23. data/test/selenium/mapping_test.rb +14 -14
  24. data/test/selenium/viewer_test.rb +4 -9
  25. data/test/selenium_test_helper.rb +86 -85
  26. data/test/test_app/Gemfile +0 -2
  27. data/test/test_app/Rakefile +3 -0
  28. data/test/test_app/app/views/layouts/local.html.erb +2 -3
  29. data/test/test_app/config/application.rb +29 -0
  30. data/test/test_app/config/boot.rb +6 -0
  31. data/test/test_app/config/environment.rb +2 -0
  32. data/test/test_app/config/initializers/dom_glancy_initializer.rb +8 -4
  33. data/test/test_app/config.ru +2 -29
  34. data/test/test_app/script/rails +6 -0
  35. data/test/test_helper.rb +5 -7
  36. data/test/test_helpers/location_helpers.rb +23 -21
  37. data/test/test_objects/test_objects.rb +40 -42
  38. data/test/unit/analysis_test.rb +9 -10
  39. data/test/unit/{kracker_test.rb → dom_glancy_test.rb} +20 -21
  40. data/test/unit/element_test.rb +8 -8
  41. data/test/unit/location_test.rb +8 -7
  42. metadata +25 -13
  43. data/lib/dom_glancy/rails/engine.rb +0 -7
  44. data/test/test_app/config/database.yml +0 -13
  45. data/test/test_app/test_app.rb +0 -30
  46. data/test/test_helpers/kracker_class_for_stubbing.rb +0 -3
@@ -15,9 +15,12 @@ rescue Bundler::BundlerError => e
15
15
  exit e.status_code
16
16
  end
17
17
 
18
- require 'rails/all'
19
- require 'dom_glancy'
20
- require 'test_app/test_app'
18
+ require 'action_controller/railtie'
19
+ require 'action_mailer/railtie'
20
+ require 'sprockets/railtie'
21
+ require 'rails/test_unit/railtie'
22
+
23
+ require File.expand_path('../test_app/config/environment', __FILE__)
21
24
 
22
25
  require 'minitest/autorun'
23
26
 
@@ -38,110 +41,108 @@ Dir[test_helper_location].each { |f| require f }
38
41
 
39
42
  Capybara.default_driver = :selenium
40
43
 
41
- module DomGlancy
42
- class SeleniumTestCase < Minitest::Test
43
- include DomGlancy
44
- include DomGlancy::TestObjects
45
- include DomGlancy::TestHelpers::Location
46
-
47
- include Capybara::DSL
44
+ class SeleniumTestCase < Minitest::Test
45
+ include TestObjects
46
+ include TestHelpers::Location
48
47
 
49
- def setup
50
- delete_contents_from_dom_glancy_locations
51
- initialize_browser_size_for_test
52
- end
48
+ include Capybara::DSL
53
49
 
54
- def teardown
55
- delete_contents_from_dom_glancy_locations
56
- end
50
+ def setup
51
+ @dom_glancy = DomGlancy::DomGlancy.new
52
+ delete_contents_from_dom_glancy_locations
53
+ initialize_browser_size_for_test
54
+ end
57
55
 
58
- def initialize_browser_size_for_test
59
- @browser_dimensions = ENV['BROWSER_SIZE'] || '960x1000'
60
- if @browser_dimensions
61
- @starting_dimensions = get_current_browser_dimensions
62
- w = @browser_dimensions.split('x')[0]
63
- h = @browser_dimensions.split('x')[1]
64
- resize_browser(w, h)
65
- end
66
- end
56
+ def teardown
57
+ delete_contents_from_dom_glancy_locations
58
+ end
67
59
 
68
- def visit_index
69
- PageObjects::DomGlancy::IndexPage.visit
60
+ def initialize_browser_size_for_test
61
+ @browser_dimensions = ENV['BROWSER_SIZE'] || '960x1000'
62
+ if @browser_dimensions
63
+ @starting_dimensions = get_current_browser_dimensions
64
+ w = @browser_dimensions.split('x')[0]
65
+ h = @browser_dimensions.split('x')[1]
66
+ resize_browser(w, h)
70
67
  end
68
+ end
71
69
 
72
- def remove_about_element
73
- js = <<-JS
74
- var element = document.getElementById('js-kr--nav');
75
- element.parentNode.removeChild(element);
76
- JS
70
+ def visit_index
71
+ PageObjects::DomGlancy::IndexPage.visit
72
+ end
77
73
 
78
- page.driver.browser.execute_script(js)
79
- end
74
+ def remove_about_element
75
+ js = <<-JS
76
+ var element = document.getElementById('js-kr--nav');
77
+ element.parentNode.removeChild(element);
78
+ JS
80
79
 
81
- def add_centered_element(text_content)
82
- js = <<-JS
83
- var centeredElement = document.createElement('div');
84
- centeredElement.style.textAlign = 'center';
85
- centeredElement.style.fontSize = '2em';
86
- centeredElement.style.width = '400px';
87
- centeredElement.style.marginLeft = 'auto';
88
- centeredElement.style.marginRight = 'auto';
89
- centeredElement.id = 'hack-element';
90
- centeredElement.textContent = '#{text_content}';
91
- centeredElement.style.backgroundColor = '#ff0000'
92
- document.getElementsByTagName('body')[0].appendChild(centeredElement);
93
- JS
94
-
95
- page.driver.browser.execute_script(js)
96
- end
80
+ page.driver.browser.execute_script(js)
81
+ end
97
82
 
98
- def resize_browser(width, height)
99
- page.driver.browser.manage.window.resize_to(width.to_i, height.to_i)
100
- end
83
+ def add_centered_element(text_content)
84
+ js = <<-JS
85
+ var centeredElement = document.createElement('div');
86
+ centeredElement.style.textAlign = 'center';
87
+ centeredElement.style.fontSize = '2em';
88
+ centeredElement.style.width = '400px';
89
+ centeredElement.style.marginLeft = 'auto';
90
+ centeredElement.style.marginRight = 'auto';
91
+ centeredElement.id = 'hack-element';
92
+ centeredElement.textContent = '#{text_content}';
93
+ centeredElement.style.backgroundColor = '#ff0000'
94
+ document.getElementsByTagName('body')[0].appendChild(centeredElement);
95
+ JS
96
+
97
+ page.driver.browser.execute_script(js)
98
+ end
101
99
 
102
- def get_current_browser_dimensions
103
- page.driver.browser.manage.window.size
104
- end
100
+ def resize_browser(width, height)
101
+ page.driver.browser.manage.window.resize_to(width.to_i, height.to_i)
102
+ end
105
103
 
106
- def assert_artifacts_on_difference(test_root)
107
- filename = DomGlancy.diff_filename(test_root)
108
- assert File.exists?(filename), "Diff file should exist: #{filename}"
104
+ def get_current_browser_dimensions
105
+ page.driver.browser.manage.window.size
106
+ end
109
107
 
110
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__changed_master__diff.yaml")
111
- assert File.exists?(filename), "Changed master file should exist: #{filename}"
108
+ def assert_artifacts_on_difference(test_root)
109
+ filename = DomGlancy::DomGlancy.diff_filename(test_root)
110
+ assert File.exists?(filename), "Diff file should exist: #{filename}"
112
111
 
113
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__current_not_master__diff.yaml")
114
- assert File.exists?(filename), "Current, not master, file should exist: #{filename}"
112
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__changed_master__diff.yaml")
113
+ assert File.exists?(filename), "Changed master file should exist: #{filename}"
115
114
 
116
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
117
- assert File.exists?(filename), "Master, not current, file should exist: #{filename}"
115
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__current_not_master__diff.yaml")
116
+ assert File.exists?(filename), "Current, not master, file should exist: #{filename}"
118
117
 
119
- filename = DomGlancy.master_filename(test_root)
120
- assert File.exists?(filename), "Master file should exist: #{filename}"
118
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
119
+ assert File.exists?(filename), "Master, not current, file should exist: #{filename}"
121
120
 
122
- filename = DomGlancy.current_filename(test_root)
123
- assert File.exists?(filename), "Current file should exist: #{filename}"
124
- end
121
+ filename = DomGlancy::DomGlancy.master_filename(test_root)
122
+ assert File.exists?(filename), "Master file should exist: #{filename}"
125
123
 
126
- def assert_artifacts_on_same(test_root)
127
- filename = DomGlancy.diff_filename(test_root)
128
- refute File.exists?(filename), "No diff file should exist: #{filename}"
124
+ filename = DomGlancy::DomGlancy.current_filename(test_root)
125
+ assert File.exists?(filename), "Current file should exist: #{filename}"
126
+ end
129
127
 
130
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__changed_master__diff.yaml")
131
- refute File.exists?(filename), "No changed master file should exist: #{filename}"
128
+ def assert_artifacts_on_same(test_root)
129
+ filename = DomGlancy::DomGlancy.diff_filename(test_root)
130
+ refute File.exists?(filename), "No diff file should exist: #{filename}"
132
131
 
133
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__current_not_master__diff.yaml")
134
- refute File.exists?(filename), "No current, not master, file should exist: #{filename}"
132
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__changed_master__diff.yaml")
133
+ refute File.exists?(filename), "No changed master file should exist: #{filename}"
135
134
 
136
- filename = File.join(DomGlancy.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
137
- refute File.exists?(filename), "No master, not current, file should exist: #{filename}"
135
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__current_not_master__diff.yaml")
136
+ refute File.exists?(filename), "No current, not master, file should exist: #{filename}"
138
137
 
139
- filename = DomGlancy.master_filename(test_root)
140
- assert File.exists?(filename), "Master file should exist: #{filename}"
138
+ filename = File.join(DomGlancy.configuration.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
139
+ refute File.exists?(filename), "No master, not current, file should exist: #{filename}"
141
140
 
142
- filename = DomGlancy.current_filename(test_root)
143
- refute File.exists?(filename), "No current file should exist: #{filename}"
144
- end
141
+ filename = DomGlancy::DomGlancy.master_filename(test_root)
142
+ assert File.exists?(filename), "Master file should exist: #{filename}"
145
143
 
144
+ filename = DomGlancy::DomGlancy.current_filename(test_root)
145
+ refute File.exists?(filename), "No current file should exist: #{filename}"
146
146
  end
147
+
147
148
  end
@@ -2,9 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'rails', '3.2.16'
4
4
  gem 'json'
5
- gem 'sqlite3'
6
5
 
7
6
  group :test, :development do
8
7
  gem 'dom_glancy', :path => '../..'
9
8
  end
10
-
@@ -0,0 +1,3 @@
1
+ require File.expand_path('../config/application', __FILE__)
2
+
3
+ TestApp::Application.load_tasks
@@ -2,8 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Local</title>
5
- <%= stylesheet_link_tag "local_app" %>
6
-
5
+ <%= stylesheet_link_tag 'local_app' %>
7
6
  </head>
8
7
  <body>
9
8
  <h1>local layout</h1>
@@ -11,4 +10,4 @@
11
10
  <%= yield %>
12
11
  <hr/>
13
12
  </body>
14
- </html>
13
+ </html>
@@ -0,0 +1,29 @@
1
+ require 'action_controller/railtie'
2
+ require 'action_mailer/railtie'
3
+ require 'sprockets/railtie'
4
+ require 'rails/test_unit/railtie'
5
+
6
+ if defined?(Bundler)
7
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
8
+ end
9
+
10
+ module TestApp
11
+ class Application < Rails::Application
12
+ config.eager_load = true
13
+ config.cache_classes = true
14
+ config.serve_static_assets = true
15
+ config.static_cache_control = "public, max-age=3600"
16
+ config.active_support.deprecation = :stderr
17
+
18
+ config.encoding = 'utf-8'
19
+ config.filter_parameters += [:password]
20
+ config.assets.enabled = true
21
+ config.assets.version = '1.0'
22
+
23
+ # Configure cookies
24
+ config.secret_token = (('a'..'z').to_a * 2).join
25
+ config.session_store :cookie_store
26
+
27
+ I18n.enforce_available_locales = false
28
+ end
29
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,2 @@
1
+ require File.expand_path('../application', __FILE__)
2
+ TestApp::Application.initialize!
@@ -1,5 +1,9 @@
1
- DomGlancy.master_file_location = Rails.root.join('tmp', 'data', 'map', 'masters')
2
- DomGlancy.current_file_location = Rails.root.join('tmp', 'data', 'map', 'current')
3
- DomGlancy.diff_file_location = Rails.root.join('tmp', 'data', 'map', 'diff')
1
+ DomGlancy.configure do |c|
2
+ c.master_file_location = Rails.root.join('tmp', 'data', 'map', 'masters')
3
+ c.current_file_location = Rails.root.join('tmp', 'data', 'map', 'current')
4
+ c.diff_file_location = Rails.root.join('tmp', 'data', 'map', 'diff')
5
+ end
4
6
 
5
- DomGlancy.create_comparison_directories
7
+ FileUtils.mkdir_p(DomGlancy.configuration.master_file_location)
8
+ FileUtils.mkdir_p(DomGlancy.configuration.diff_file_location)
9
+ FileUtils.mkdir_p(DomGlancy.configuration.current_file_location)
@@ -1,31 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
- ENV['RAILS_ENV'] = 'development'
3
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
5
-
6
- require 'rubygems'
7
- require 'bundler'
8
-
9
- # Set up gems listed in the Gemfile.
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __FILE__)
11
-
12
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
13
-
14
- begin
15
- Bundler.setup(:default, :development)
16
- rescue Bundler::BundlerError => e
17
- $stderr.puts e.message
18
- $stderr.puts "Run `bundle install` to install missing gems"
19
- exit e.status_code
20
- end
21
-
22
- require "action_controller/railtie"
23
- require "sprockets/railtie"
24
- require 'rails'
25
-
2
+ require File.expand_path('../config/environment', __FILE__)
26
3
  require 'dom_glancy'
27
-
28
- Rails.backtrace_cleaner.remove_silencers!
29
-
30
- require 'test_app'
31
- run DomGlancyApp::Application
4
+ run TestApp::Application
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
data/test/test_helper.rb CHANGED
@@ -31,13 +31,11 @@ Dir[test_objects_location].each { |f| require f }
31
31
  test_helper_location = File.expand_path('../test_helpers/**/*.rb', __FILE__)
32
32
  Dir[test_helper_location].each { |f| require f }
33
33
 
34
+ class DomGlancyTestCase < Minitest::Test
35
+ include TestObjects
36
+ include TestHelpers::Location
34
37
 
35
- module DomGlancy
36
- class DomGlancyTestCase < Minitest::Test
37
-
38
- include DomGlancy
39
- include DomGlancy::TestObjects
40
- include DomGlancy::TestHelpers::Location
41
-
38
+ def setup
39
+ @dom_glancy = DomGlancy::DomGlancy.new
42
40
  end
43
41
  end
@@ -1,28 +1,30 @@
1
- module DomGlancy
2
- module TestHelpers
3
- module Location
4
- def prep_locations_for_test
5
- @locations_root = File.expand_path('../../tmp', __FILE__)
1
+ module TestHelpers
2
+ module Location
3
+ def prep_locations_for_test
4
+ @locations_root = File.expand_path('../../tmp', __FILE__)
6
5
 
7
- DomGlancy.master_file_location = File.join(@locations_root, 'masters')
8
- DomGlancy.current_file_location = File.join(@locations_root, 'current')
9
- DomGlancy.diff_file_location = File.join(@locations_root, 'diff')
10
-
11
- DomGlancy.create_comparison_directories
6
+ DomGlancy.configure do |config|
7
+ config.master_file_location = File.join(@locations_root, 'masters')
8
+ config.current_file_location = File.join(@locations_root, 'current')
9
+ config.diff_file_location = File.join(@locations_root, 'diff')
12
10
  end
13
11
 
14
- def delete_test_locations
15
- FileUtils.rm_rf DomGlancy.master_file_location
16
- FileUtils.rm_rf DomGlancy.current_file_location
17
- FileUtils.rm_rf DomGlancy.diff_file_location
18
- end
12
+ FileUtils.mkdir_p(DomGlancy.configuration.master_file_location)
13
+ FileUtils.mkdir_p(DomGlancy.configuration.diff_file_location)
14
+ FileUtils.mkdir_p(DomGlancy.configuration.current_file_location)
15
+ end
19
16
 
20
- def delete_contents_from_dom_glancy_locations
21
- Dir[File.join(DomGlancy.master_file_location, "*.yaml")].each { |file| FileUtils.rm_rf file }
22
- Dir[File.join(DomGlancy.current_file_location, "*.yaml")].each { |file| FileUtils.rm_rf file }
23
- Dir[File.join(DomGlancy.diff_file_location, "*.html")].each { |file| FileUtils.rm_rf file }
24
- Dir[File.join(DomGlancy.diff_file_location, "*.yaml")].each { |file| FileUtils.rm_rf file }
25
- end
17
+ def delete_test_locations
18
+ FileUtils.rm_rf DomGlancy.configuration.master_file_location
19
+ FileUtils.rm_rf DomGlancy.configuration.current_file_location
20
+ FileUtils.rm_rf DomGlancy.configuration.diff_file_location
21
+ end
22
+
23
+ def delete_contents_from_dom_glancy_locations
24
+ Dir[File.join(DomGlancy.configuration.master_file_location, '*.yaml')].each { |file| FileUtils.rm_rf file }
25
+ Dir[File.join(DomGlancy.configuration.current_file_location, '*.yaml')].each { |file| FileUtils.rm_rf file }
26
+ Dir[File.join(DomGlancy.configuration.diff_file_location, '*.html')].each { |file| FileUtils.rm_rf file }
27
+ Dir[File.join(DomGlancy.configuration.diff_file_location, '*.yaml')].each { |file| FileUtils.rm_rf file }
26
28
  end
27
29
  end
28
30
  end
@@ -1,34 +1,33 @@
1
- module DomGlancy
2
- module TestObjects
3
- def array_of_elements
4
- [
5
- {"id"=>"1", "height"=>238, "visible"=>true, "tag"=>"DIV", "width"=>720, "class"=>"grid", "left"=>43, "top"=>14},
6
- {"id"=>"2", "height"=>132, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>14},
7
- {"id"=>"3", "height"=>132, "visible"=>true, "tag"=>"DIV", "width"=>340, "class"=>"slot-0-1-2 mm--title_text_main", "left"=>53, "top"=>14},
8
- {"id"=>"4", "height"=>132, "visible"=>true, "tag"=>"H1", "width"=>340, "class"=>"", "left"=>53, "top"=>14},
9
- {"id"=>"5", "height"=>0, "visible"=>true, "tag"=>"SPAN", "width"=>0, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86},
10
- {"id"=>"6", "height"=>55, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>160},
11
- {"id"=>"7", "height"=>55, "visible"=>true, "tag"=>"DIV", "width"=>340, "class"=>"slot-0-1-2", "left"=>53, "top"=>160},
12
- {"id"=>"8", "height"=>55, "visible"=>true, "tag"=>"H2", "width"=>340, "class"=>"", "left"=>53, "top"=>160},
13
- {"id"=>"9", "height"=>23, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>229},
14
- {"id"=>"10", "height"=>21, "visible"=>true, "tag"=>"DIV", "width"=>100, "class"=>"slot-0 mm--nav", "left"=>53, "top"=>231},
15
- {"id"=>"11", "height"=>21, "visible"=>true, "tag"=>"DIV", "width"=>100, "class"=>"slot-1 mm--nav", "left"=>173, "top"=>231}
16
- ]
17
- end
1
+ module TestObjects
2
+ def array_of_elements
3
+ [
4
+ {"id"=>"1", "height"=>238, "visible"=>true, "tag"=>"DIV", "width"=>720, "class"=>"grid", "left"=>43, "top"=>14},
5
+ {"id"=>"2", "height"=>132, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>14},
6
+ {"id"=>"3", "height"=>132, "visible"=>true, "tag"=>"DIV", "width"=>340, "class"=>"slot-0-1-2 mm--title_text_main", "left"=>53, "top"=>14},
7
+ {"id"=>"4", "height"=>132, "visible"=>true, "tag"=>"H1", "width"=>340, "class"=>"", "left"=>53, "top"=>14},
8
+ {"id"=>"5", "height"=>0, "visible"=>true, "tag"=>"SPAN", "width"=>0, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86},
9
+ {"id"=>"6", "height"=>55, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>160},
10
+ {"id"=>"7", "height"=>55, "visible"=>true, "tag"=>"DIV", "width"=>340, "class"=>"slot-0-1-2", "left"=>53, "top"=>160},
11
+ {"id"=>"8", "height"=>55, "visible"=>true, "tag"=>"H2", "width"=>340, "class"=>"", "left"=>53, "top"=>160},
12
+ {"id"=>"9", "height"=>23, "visible"=>true, "tag"=>"DIV", "width"=>700, "class"=>"row", "left"=>53, "top"=>229},
13
+ {"id"=>"10", "height"=>21, "visible"=>true, "tag"=>"DIV", "width"=>100, "class"=>"slot-0 mm--nav", "left"=>53, "top"=>231},
14
+ {"id"=>"11", "height"=>21, "visible"=>true, "tag"=>"DIV", "width"=>100, "class"=>"slot-1 mm--nav", "left"=>173, "top"=>231}
15
+ ]
16
+ end
18
17
 
19
- def array_of_elements_small
20
- [
21
- {"id"=>"12", "height"=>238, "visible"=>true, "tag"=>"DIV", "width"=>720, "class"=>"grid", "left"=>43, "top"=>14},
22
- {"id"=>"14", "height"=>0, "visible"=>true, "tag"=>"SPAN", "width"=>0, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86}
23
- ]
24
- end
18
+ def array_of_elements_small
19
+ [
20
+ {"id"=>"12", "height"=>238, "visible"=>true, "tag"=>"DIV", "width"=>720, "class"=>"grid", "left"=>43, "top"=>14},
21
+ {"id"=>"14", "height"=>0, "visible"=>true, "tag"=>"SPAN", "width"=>0, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86}
22
+ ]
23
+ end
25
24
 
26
- def single_element_hash
27
- {"id"=>"mm--single_added", "height"=>10, "visible"=>true, "tag"=>"SPAN", "width"=>50, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86}
28
- end
25
+ def single_element_hash
26
+ {"id"=>"mm--single_added", "height"=>10, "visible"=>true, "tag"=>"SPAN", "width"=>50, "class"=>"mm--title_text_sub", "left"=>71, "top"=>86}
27
+ end
29
28
 
30
- def travis_generated_current_2
31
- data = <<-DATA
29
+ def travis_generated_current_2
30
+ data = <<-DATA
32
31
  ---
33
32
  - height: 45
34
33
  width: 784
@@ -590,12 +589,12 @@ module DomGlancy
590
589
  top: 0
591
590
  left: 0
592
591
  visible: false
593
-
592
+
594
593
  DATA
595
-
594
+
596
595
  YAML::load(data)
597
596
  end
598
-
597
+
599
598
  def travis_local_generated_master_2
600
599
  data = <<-DATA
601
600
  ---
@@ -1160,11 +1159,11 @@ module DomGlancy
1160
1159
  left: 0
1161
1160
  visible: false
1162
1161
  DATA
1163
-
1162
+
1164
1163
  YAML::load(data)
1165
1164
  end
1166
-
1167
-
1165
+
1166
+
1168
1167
  def travis_generated_current
1169
1168
  data = <<-DATA
1170
1169
  ---
@@ -1592,12 +1591,12 @@ module DomGlancy
1592
1591
  top: 0
1593
1592
  left: 0
1594
1593
  visible: false
1595
- DATA
1596
- YAML::load(data)
1597
- end
1594
+ DATA
1595
+ YAML::load(data)
1596
+ end
1598
1597
 
1599
- def travis_local_generated_master
1600
- data = <<-DATA
1598
+ def travis_local_generated_master
1599
+ data = <<-DATA
1601
1600
  ---
1602
1601
  - height: 45
1603
1602
  width: 800
@@ -2024,8 +2023,7 @@ module DomGlancy
2024
2023
  left: 0
2025
2024
  visible: false
2026
2025
 
2027
- DATA
2028
- YAML::load(data)
2029
- end
2026
+ DATA
2027
+ YAML::load(data)
2030
2028
  end
2031
2029
  end
@@ -1,13 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
- class AnalysisTest < DomGlancy::DomGlancyTestCase
3
+ class AnalysisTest < DomGlancyTestCase
4
4
 
5
5
  def test_same_elements
6
-
7
6
  master_data = array_of_elements
8
7
  current_data = array_of_elements
9
8
 
10
- analysis = analyze(master_data, current_data)
9
+ analysis = @dom_glancy.analyze(master_data, current_data)
11
10
 
12
11
  assert_equal 0, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
13
12
  assert_equal 0, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -19,7 +18,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
19
18
  current_data = array_of_elements_small
20
19
  current_data.first['id'] = 'some-new-id'
21
20
 
22
- analysis = analyze(master_data, current_data)
21
+ analysis = @dom_glancy.analyze(master_data, current_data)
23
22
 
24
23
  assert_equal 1, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
25
24
  assert_equal 1, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -31,7 +30,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
31
30
  current_data = array_of_elements
32
31
  current_data << single_element_hash
33
32
 
34
- analysis = analyze(master_data, current_data)
33
+ analysis = @dom_glancy.analyze(master_data, current_data)
35
34
 
36
35
  assert_equal 1, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
37
36
  assert_equal 0, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -44,7 +43,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
44
43
  current_data[0]['height'] = current_data[0]['height'] + 16
45
44
  current_data[1]['width'] = current_data[1]['width'] + 25
46
45
 
47
- analysis = analyze(master_data, current_data)
46
+ analysis = @dom_glancy.analyze(master_data, current_data)
48
47
 
49
48
  assert_equal 0, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
50
49
  assert_equal 0, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -59,7 +58,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
59
58
 
60
59
  current_data[1]['height'] = current_data[1]['height'] + 3
61
60
 
62
- analysis = analyze(master_data, current_data)
61
+ analysis = @dom_glancy.analyze(master_data, current_data)
63
62
 
64
63
  assert_equal 0, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
65
64
  assert_equal 0, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -76,7 +75,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
76
75
  current_data.delete_at(5) ## the one missing
77
76
  current_data << single_element_hash ## the one added
78
77
 
79
- analysis = analyze(master_data, current_data)
78
+ analysis = @dom_glancy.analyze(master_data, current_data)
80
79
 
81
80
  assert_equal 1, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
82
81
  assert_equal 1, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
@@ -88,7 +87,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
88
87
  master_data = travis_local_generated_master
89
88
  current_data = travis_generated_current
90
89
 
91
- analysis = analyze(master_data, current_data)
90
+ analysis = @dom_glancy.analyze(master_data, current_data)
92
91
  assert_equal 0, analysis[:not_in_master].count, 'results of data analysis: not_in_master'
93
92
  assert_equal 0, analysis[:not_in_current].count, 'results of data analysis: not_in_current'
94
93
  assert_equal 0, analysis[:changed_element_pairs].count, 'changed element pairs'
@@ -99,7 +98,7 @@ class AnalysisTest < DomGlancy::DomGlancyTestCase
99
98
  master_data = travis_local_generated_master_2
100
99
  current_data = travis_generated_current_2
101
100
 
102
- analysis = analyze(master_data, current_data)
101
+ analysis = @dom_glancy.analyze(master_data, current_data)
103
102
 
104
103
  ## real difference that was found on travis with the INPUT tags being different styles/sizes if not css-styled
105
104
  assert_equal 0, analysis[:not_in_master].count, 'results of data analysis: not_in_master'