kracker 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a82f88dd9e535f033f95cb5d3e55f7f750c5d8ce
4
- data.tar.gz: bb78e59d2d84010fca771793ea381fa25fdc36ce
3
+ metadata.gz: 61346c706348ae78ccf2739f62c62d132ff27d3f
4
+ data.tar.gz: 129c1fdf63cb2c97f609d91be74e05100d751f7f
5
5
  SHA512:
6
- metadata.gz: 59d7782c28372a1cc22822a252d0bfd920d45f8794cbe5772b5aff1ec360008543a48087f9e80d2368f38c46f2d648cd41d72010f04cc97b20eea60c69ef50d9
7
- data.tar.gz: e1c2b002db5448fee7f079af793938891647eb997fca1d2a14feffb6693af225d2634d151d7e0bf6915e4bf32c6bae4c74e54eaf6efdc7cfda63bbe7486e11f7
6
+ metadata.gz: 2c77b6a589b65375de31df8862ea41223bf0236622f8cc5cb4c7f515a55e5b6b3f9ffcf37977c63768e8705bec30fa1f9876d8c91608903dd21849ae6223e733
7
+ data.tar.gz: b489c575a18a781d12916b84341f16931f5bcdd3508225cc13838eef94e3053c5b494e6dc1fdca90384a0100756793ee4b2b78751225af2bfdf908b76794c46b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.0-p353
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ gem 'minitest-reporters'
10
10
  gem 'awesome_print'
11
11
  gem 'mocha'
12
12
 
13
- gem 'selenium-webdriver', '2.37.0'
13
+ gem 'selenium-webdriver', '2.42.0'
14
14
  gem 'capybara', '2.2.1'
15
15
  gem 'ae_page_objects', '1.0.0'
16
16
 
data/kracker.gemspec CHANGED
@@ -23,5 +23,6 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency(%q<kramdown>, ["~> 1.1.0"])
25
25
  spec.add_dependency 'capybara'
26
+ spec.add_dependency 'chunky_png'
26
27
 
27
28
  end
@@ -48,7 +48,7 @@ module Kracker
48
48
  output_hash
49
49
  end
50
50
 
51
- def make_svg(set_master_not_current, set_current_not_master)
51
+ def make_svg(set_master_not_current, set_current_not_master, set_changed_master)
52
52
  js_id = 0
53
53
  set_master_not_current.each do |item|
54
54
  item[:js_id] = js_id
@@ -58,9 +58,14 @@ module Kracker
58
58
  item[:js_id] = js_id
59
59
  js_id += 1
60
60
  end
61
+ set_changed_master.each do |item|
62
+ item[:js_id] = js_id
63
+ js_id += 1
64
+ end
61
65
 
62
66
  rectangles = set_current_not_master.map { |item| item.merge(format__not_in_master) }
63
67
  rectangles << set_master_not_current.map { |item| item.merge(format__not_in_current) }
68
+ rectangles << set_changed_master.map { |item| item.merge(format__same_but_different) }
64
69
  rectangles.flatten!
65
70
 
66
71
  generate_svg(rectangles)
@@ -68,7 +73,7 @@ module Kracker
68
73
 
69
74
  def create_diff_file(set_current_not_master, set_master_not_current, set_changed_master, test_root)
70
75
  filename = Kracker.diff_filename(test_root)
71
- svg = make_svg(set_current_not_master, set_master_not_current)
76
+ svg = make_svg(set_current_not_master, set_master_not_current, set_changed_master)
72
77
  File.open(filename, 'w') { |file| file.write(svg) }
73
78
  save_set_info(test_root, 'current_not_master', set_current_not_master)
74
79
  save_set_info(test_root, 'master_not_current', set_master_not_current)
@@ -133,4 +138,4 @@ module Kracker
133
138
  "cp #{Kracker.current_filename(test_root)} #{Kracker.master_filename(test_root)}"
134
139
  end
135
140
 
136
- end
141
+ end
@@ -2,6 +2,7 @@ module Kracker
2
2
  require 'yaml'
3
3
 
4
4
  def page_map_same?(test_root)
5
+ purge_old_files_before_test(test_root)
5
6
 
6
7
  result, msg = map_current_file(test_root)
7
8
  return [result, msg] unless result
@@ -20,6 +21,8 @@ module Kracker
20
21
  msg = make_analysis_failure_report(analysis_data)
21
22
  result = analysis_data[:same]
22
23
 
24
+ File.delete Kracker.current_filename(test_root) if result
25
+
23
26
  [result, msg]
24
27
  end
25
28
 
@@ -109,4 +112,10 @@ module Kracker
109
112
  msg.join("\n")
110
113
  end
111
114
 
115
+ def purge_old_files_before_test(test_root)
116
+ File.delete Kracker.current_filename(test_root) if File.exist?(Kracker.current_filename(test_root))
117
+
118
+ filename_pattern = File.join(Kracker.diff_file_location, "#{test_root}__*__diff.yaml")
119
+ Dir[filename_pattern].each { |file| file.delete(file) if File.exist?(file) }
120
+ end
112
121
  end
@@ -1,3 +1,3 @@
1
1
  module Kracker
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,157 @@
1
+ module Kracker
2
+ module Zooka
3
+ class Analyzer
4
+ attr_accessor :tolerance, :ignore_antialiasing, :ignore_colors
5
+ attr_accessor :image_1, :image_2
6
+ attr_reader :result
7
+ attr_reader :noncompliant_pixels
8
+
9
+ def initialize(options = {})
10
+ @tolerance = Tolerance.new
11
+ @ignore_antialiasing = false
12
+ @ignore_colors = false
13
+ @noncompliant_pixels = []
14
+
15
+ if options.has_key?(:image_1)
16
+ @image_1 = options[:image_1]
17
+ elsif options.has_key?(:filename_1)
18
+ @image_1 = ChunkyPNG::Image.from_file(options[:filename_1])
19
+ else
20
+ @image_1 = nil
21
+ end
22
+
23
+ if options.has_key?(:image_2)
24
+ @image_2 = options[:image_2]
25
+ elsif options.has_key?(:filename_2)
26
+ @image_2 = ChunkyPNG::Image.from_file(options[:filename_2])
27
+ else
28
+ @image_2 = nil
29
+ end
30
+ end
31
+
32
+ def analyze
33
+ @noncompliant_pixels = []
34
+ @result = ChunkyPNG::Image.new(@image_1.width, @image_1.height, ChunkyPNG::Color::TRANSPARENT)
35
+
36
+ @image_1.width.times do |x|
37
+ @image_1.height.times do |y|
38
+ pix_1 = Pixel.new(@image_1[x, y])
39
+ pix_2 = Pixel.new(@image_2[x, y])
40
+
41
+ if @ignore_colors
42
+ if brightness_similar?(pix_1, pix_2)
43
+ @result[x, y] = ChunkyPNG::Color::rgba(pix_1.red, pix_1.green, pix_1.blue, pix_1.alpha / 10)
44
+ else
45
+ @result[x, y] = ChunkyPNG::Color::rgba(255, 0, 0, 100)
46
+ @noncompliant_pixels << { x: x, y: y }
47
+ end
48
+ else
49
+ if rgb_similar?(pix_1, pix_2)
50
+ @result[x, y] = ChunkyPNG::Color::rgba(pix_1.red, pix_1.green, pix_1.blue, pix_1.alpha / 10)
51
+ elsif @ignore_antialiasing && (antialiased?(@image_1, x, y) || antialiased?(@image_2, x, y))
52
+ if brightness_similar?(pix_1, pix_2)
53
+ @result[x, y] = ChunkyPNG::Color::rgba(pix_1.red, pix_1.green, pix_1.blue, pix_1.alpha / 10)
54
+ else
55
+ @result[x, y] = ChunkyPNG::Color::rgba(255, 0, 0, 100)
56
+ @noncompliant_pixels << { x: x, y: y }
57
+ end
58
+ else
59
+ @result[x, y] = ChunkyPNG::Color::rgba(255, 0, 0, 100)
60
+ @noncompliant_pixels << { x: x, y: y }
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ def same?
68
+ @noncompliant_pixels.count == 0
69
+ end
70
+
71
+ private
72
+
73
+ def antialiased?(data, src_x, src_y)
74
+ high_contrast_siblings = 0
75
+ different_hue_siblings = 0
76
+ equivalent_siblings = 0
77
+
78
+ pixel = Pixel.new(data[src_x, src_y])
79
+
80
+ result = false
81
+
82
+ other_pixels = []
83
+
84
+ (-1..1).each do |x|
85
+ (-1..1).each do |y|
86
+ unless x == 0 && y == 0
87
+ other_x = src_x + x
88
+ other_y = src_y + y
89
+
90
+ next if other_x >= data.width
91
+ next if other_x < 0
92
+ next if other_y >= data.height
93
+ next if other_y < 0
94
+
95
+ other_pixels << Pixel.new(data[other_x, other_y])
96
+ end
97
+ end
98
+ end
99
+
100
+ if other_pixels.length == 8
101
+ other_pixels.each do |other_pixel|
102
+ high_contrast_siblings = high_contrast_siblings + 1 if contrasting?(pixel, other_pixel)
103
+ equivalent_siblings = equivalent_siblings + 1 if rgb_same?(pixel, other_pixel)
104
+ different_hue_siblings = different_hue_siblings + 1 unless hue_same?(pixel, other_pixel)
105
+
106
+ if different_hue_siblings > 1 || high_contrast_siblings > 1
107
+ return true
108
+ end
109
+ end
110
+
111
+ result = equivalent_siblings < 2
112
+ else
113
+ result = false
114
+ end
115
+
116
+ result
117
+ end
118
+
119
+ def contrasting?(pix1, pix2)
120
+ (pix1.brightness - pix2.brightness).abs > @tolerance.max_brightness
121
+ end
122
+
123
+ def rgb_same?(pix1, pix2)
124
+ red_same = pix1.red == pix2.red
125
+ green_same = pix1.green == pix2.green
126
+ blue_same = pix1.blue == pix2.blue
127
+
128
+ red_same && green_same && blue_same
129
+ end
130
+
131
+ def hue_same?(pix1, pix2)
132
+ (pix1.hue - pix2.hue).abs <= @tolerance.hue
133
+ end
134
+
135
+ def rgb_similar?(pix1, pix2)
136
+ red_similar = color_similar?(pix1.red, pix2.red, 'red')
137
+ green_similar = color_similar?(pix1.green, pix2.green, 'green')
138
+ blue_similar = color_similar?(pix1.blue, pix2.blue, 'blue')
139
+ alpha_similar = color_similar?(pix1.alpha, pix2.alpha, 'alpha')
140
+
141
+ red_similar && green_similar && blue_similar && alpha_similar
142
+ end
143
+
144
+ def color_similar?(a, b, color)
145
+ return true if a == b
146
+ (a - b).abs < @tolerance.color(color)
147
+ end
148
+
149
+ def brightness_similar?(pix1, pix2)
150
+ alpha = color_similar?(pix1.alpha, pix2.alpha, 'alpha')
151
+ brightness = color_similar?(pix1.brightness, pix2.brightness, 'min_brightness')
152
+ brightness && alpha
153
+ end
154
+
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,32 @@
1
+ module Kracker
2
+ module Zooka
3
+ class ErrorPixelTransform
4
+ attr_accessor :red, :green, :blue, :alpha
5
+
6
+ def initialize
7
+ @red = 255
8
+ @green = 0
9
+ @blue = 255
10
+ @alpha = 255
11
+ end
12
+
13
+ def flat(d1, d2)
14
+ {
15
+ r: @red,
16
+ g: @green,
17
+ b: @blue,
18
+ a: @alpha
19
+ }
20
+ end
21
+
22
+ def movement(d1, d2)
23
+ {
24
+ r: ((d2.red * (@red/255)) + @red) / 2,
25
+ g: ((d2.green * (@green/255)) + @green) / 2,
26
+ b: ((d2.blue * (@blue/255)) + @blue) / 2,
27
+ a: d2.alpha
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,70 @@
1
+ module Kracker
2
+ module Zooka
3
+ class Image
4
+ attr_accessor :data, :pixels
5
+ attr_accessor :red, :green, :blue, :alpha, :brightness
6
+ attr_accessor :red_total, :green_total, :blue_total, :brightness_total
7
+
8
+ def initialize(data)
9
+ @data = data
10
+ compute_image_summary
11
+ end
12
+
13
+ def display_image_info
14
+ puts '-'*22
15
+ puts " Width: #{@data.width}"
16
+ puts " Height: #{@data.height}"
17
+ puts " Avg. Red: #{@red}"
18
+ puts " Avg. Green: #{@green}"
19
+ puts " Avg. Blue: #{@blue}"
20
+ puts " Total Red: #{@red_total}"
21
+ puts " Total Green: #{@green_total}"
22
+ puts " Total Blue: #{@blue_total}"
23
+ puts '-'*22
24
+ end
25
+
26
+ private
27
+
28
+ def on_all_pixels(image, &block)
29
+ image.width.times do |x|
30
+ image.height.times do |y|
31
+ block.call(image[x, y])
32
+ end
33
+ end
34
+ end
35
+
36
+ def compute_image_summary
37
+ @red = 0
38
+ @green = 0
39
+ @blue = 0
40
+ @pixels = 0
41
+
42
+ @red_total = 0
43
+ @green_total = 0
44
+ @blue_total = 0
45
+ @brightness_total = 0
46
+
47
+ on_all_pixels(@data) do |pixel_value|
48
+ p = Pixel.new(pixel_value)
49
+ @pixels = @pixels + 1
50
+ @red = @red + p.red
51
+ @green = @green + p.green
52
+ @blue = @blue + p.blue
53
+
54
+ @red_total = @red_total + p.red / 255 * 100
55
+ @green_total = @green_total + p.green / 255 * 100
56
+ @blue_total = @blue_total = p.blue / 255 * 100
57
+ # @brightness_total = @brightness_total
58
+ end
59
+
60
+ @red = @red / @pixels
61
+ @green = @green / @pixels
62
+ @blue = @blue / @pixels
63
+
64
+ @red_total = @red_total / @pixels
65
+ @green_total = @green_total / @pixels
66
+ @blue_total = @blue_total / @pixels
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,50 @@
1
+ module Kracker
2
+ module Zooka
3
+ class Pixel
4
+ attr_accessor :red, :green, :blue, :alpha
5
+
6
+ def initialize(color_value)
7
+ @alpha = ChunkyPNG::Color.a(color_value)
8
+ @red = ChunkyPNG::Color.r(color_value)
9
+ @green = ChunkyPNG::Color.g(color_value)
10
+ @blue = ChunkyPNG::Color.b(color_value)
11
+ end
12
+
13
+ def brightness
14
+ 0.3 * @red + 0.59 * @green + 0.11 * @blue
15
+ end
16
+
17
+ def hue
18
+ red = @red / 255.0
19
+ green = @green / 255.0
20
+ blue = @blue / 255.0
21
+
22
+ min = [red, green , blue].sort.first
23
+ max = [red, green , blue].sort.last
24
+
25
+ h = 0
26
+ d = 0
27
+
28
+ if max == min
29
+ h = 0
30
+ else
31
+ d = max - min
32
+ h = case max
33
+ when red
34
+ (green - blue) / d + (green < blue ? 6 : 0)
35
+ when green
36
+ (blue - red) / d + 2
37
+ when blue
38
+ (red - green ) / d + 4
39
+ else
40
+ 0
41
+ end
42
+
43
+ h = h / 6.0
44
+ end
45
+ h
46
+ end
47
+
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,36 @@
1
+ module Kracker
2
+ module Zooka
3
+ class Tolerance
4
+ attr_accessor :red, :green, :blue, :alpha, :min_brightness, :max_brightness, :hue
5
+
6
+ def initialize
7
+ @red = 16
8
+ @green = 16
9
+ @blue = 16
10
+ @alpha = 16
11
+ @min_brightness = 16
12
+ @max_brightness = 240
13
+ @hue = 0.3
14
+ end
15
+
16
+ def color(c)
17
+ case c.downcase.to_sym
18
+ when :alpha
19
+ @alpha
20
+ when :red
21
+ @red
22
+ when :blue
23
+ @blue
24
+ when :green
25
+ @green
26
+ when :min_brightness
27
+ @min_brightness
28
+ when :hue
29
+ @hue
30
+ else
31
+ 0
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
data/lib/kracker.rb CHANGED
@@ -5,3 +5,9 @@ require 'kracker/element'
5
5
  require 'kracker/analysis'
6
6
  require 'kracker/locations'
7
7
  require 'kracker/svg'
8
+
9
+ require 'kracker/zooka/analyzer'
10
+ require 'kracker/zooka/error_pixel_transform'
11
+ require 'kracker/zooka/image'
12
+ require 'kracker/zooka/pixel'
13
+ require 'kracker/zooka/tolerance'
@@ -10,6 +10,7 @@ class MappingTest < Kracker::SeleniumTestCase
10
10
  same, msg = page_map_same?('kracker_index')
11
11
 
12
12
  assert same, msg
13
+ assert_artifacts_on_same('kracker_index')
13
14
  end
14
15
 
15
16
  def test_mapping__no_master
@@ -19,7 +20,7 @@ class MappingTest < Kracker::SeleniumTestCase
19
20
  assert_match 'Master file does not exist', msg, 'the missing master error message'
20
21
  end
21
22
 
22
- def test_full_mapping__one_added__bless
23
+ def test_full_mapping__one_added__clear
23
24
  visit_index
24
25
 
25
26
  map_current_page_and_save_as_master('kracker_index')
@@ -75,10 +76,9 @@ class MappingTest < Kracker::SeleniumTestCase
75
76
 
76
77
  index_page = show_page.bless!
77
78
  assert_equal 0, index_page.files.count, 'number of difference files'
78
-
79
79
  end
80
80
 
81
- def test_non_kracker_page
81
+ def test_non_kracker_page__pass
82
82
  local_page = PageObjects::Kracker::LocalIndexPage.visit
83
83
 
84
84
  map_current_page_and_save_as_master('test_page')
@@ -86,6 +86,26 @@ class MappingTest < Kracker::SeleniumTestCase
86
86
  same, msg = page_map_same?('test_page')
87
87
 
88
88
  assert same, msg
89
+
90
+ assert_artifacts_on_same 'test_page'
91
+ end
92
+
93
+ def test_non_kracker_page__fail__size_change
94
+ local_page = PageObjects::Kracker::LocalIndexPage.visit
95
+
96
+ map_current_page_and_save_as_master('test_page')
97
+
98
+ starting_dimensions = get_current_browser_dimensions
99
+ w = starting_dimensions.width + 100
100
+ h = starting_dimensions.height
101
+
102
+ resize_browser(w, h)
103
+
104
+ same, msg = page_map_same?('test_page')
105
+
106
+ refute same, msg
107
+
108
+ assert_artifacts_on_difference 'test_page'
89
109
  end
90
110
 
91
111
  private
@@ -0,0 +1,64 @@
1
+ require 'selenium_test_helper'
2
+
3
+ class ZookaTest < Kracker::SeleniumTestCase
4
+
5
+ def setup
6
+ @filename_1 = Kracker::current_filename('zooka_1').gsub('yaml', 'png')
7
+ @filename_2 = Kracker::current_filename('zooka_2').gsub('yaml', 'png')
8
+
9
+ FileUtils.rm_rf @filename_1
10
+ FileUtils.rm_rf @filename_2
11
+ super
12
+ end
13
+
14
+ def teardown
15
+ FileUtils.rm_rf @filename_1
16
+ FileUtils.rm_rf @filename_2
17
+ super
18
+ end
19
+
20
+ def test_zooka__pass
21
+ index_page = visit_index
22
+
23
+ index_page.navigation.config!
24
+
25
+ page.driver.save_screenshot(@filename_1)
26
+ page.driver.save_screenshot(@filename_2)
27
+
28
+ image_1 = ChunkyPNG::Image.from_file(@filename_1)
29
+ image_2 = ChunkyPNG::Image.from_file(@filename_2)
30
+
31
+ analyzer = Kracker::Zooka::Analyzer.new({:image_1 => image_1, :image_2 => image_2})
32
+ analyzer.analyze
33
+ not_compliant = analyzer.noncompliant_pixels
34
+
35
+ expected = 0
36
+
37
+ assert analyzer.same?, 'images should be found to be the same'
38
+ assert_equal expected, not_compliant.count
39
+ end
40
+
41
+ def test_zooka__fail
42
+ index_page = visit_index
43
+
44
+ index_page.navigation.config!
45
+
46
+ page.driver.save_screenshot(@filename_1)
47
+
48
+ add_centered_element('the zooka will rock you!')
49
+ page.driver.save_screenshot(@filename_2)
50
+
51
+ image_1 = ChunkyPNG::Image.from_file(@filename_1)
52
+ image_2 = ChunkyPNG::Image.from_file(@filename_2)
53
+
54
+ analyzer = Kracker::Zooka::Analyzer.new({:image_1 => image_1, :image_2 => image_2})
55
+ analyzer.analyze
56
+ not_compliant = analyzer.noncompliant_pixels
57
+
58
+ expected = ENV['TRAVIS'] ? 27200 : 26400
59
+
60
+ refute analyzer.same?, 'images should be found to be different'
61
+ assert_equal expected, not_compliant.count
62
+ end
63
+
64
+ end
@@ -30,6 +30,8 @@ require 'selenium-webdriver'
30
30
 
31
31
  require 'page_objects'
32
32
 
33
+ require 'chunky_png'
34
+
33
35
  test_objects_location = File.expand_path('../test_objects/*', __FILE__)
34
36
  Dir[test_objects_location].each { |f| require f }
35
37
 
@@ -48,12 +50,23 @@ module Kracker
48
50
 
49
51
  def setup
50
52
  delete_contents_from_kracker_locations
53
+ initialize_browser_size_for_test
51
54
  end
52
55
 
53
56
  def teardown
54
57
  delete_contents_from_kracker_locations
55
58
  end
56
59
 
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)
67
+ end
68
+ end
69
+
57
70
  def visit_index
58
71
  PageObjects::Kracker::IndexPage.visit
59
72
  end
@@ -84,6 +97,14 @@ module Kracker
84
97
  page.driver.browser.execute_script(js)
85
98
  end
86
99
 
100
+ def resize_browser(width, height)
101
+ page.driver.browser.manage.window.resize_to(width.to_i, height.to_i)
102
+ end
103
+
104
+ def get_current_browser_dimensions
105
+ page.driver.browser.manage.window.size
106
+ end
107
+
87
108
  def assert_artifacts_on_difference(test_root)
88
109
  filename = Kracker.diff_filename(test_root)
89
110
  assert File.exists?(filename), "Diff file should exist: #{filename}"
@@ -96,7 +117,33 @@ module Kracker
96
117
 
97
118
  filename = File.join(Kracker.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
98
119
  assert File.exists?(filename), "Master, not current, file should exist: #{filename}"
120
+
121
+ filename = Kracker.master_filename(test_root)
122
+ assert File.exists?(filename), "Master file should exist: #{filename}"
123
+
124
+ filename = Kracker.current_filename(test_root)
125
+ assert File.exists?(filename), "Current file should exist: #{filename}"
126
+ end
127
+
128
+ def assert_artifacts_on_same(test_root)
129
+ filename = Kracker.diff_filename(test_root)
130
+ refute File.exists?(filename), "No diff file should exist: #{filename}"
131
+
132
+ filename = File.join(Kracker.diff_file_location, "#{test_root}__changed_master__diff.yaml")
133
+ refute File.exists?(filename), "No changed master file should exist: #{filename}"
134
+
135
+ filename = File.join(Kracker.diff_file_location, "#{test_root}__current_not_master__diff.yaml")
136
+ refute File.exists?(filename), "No current, not master, file should exist: #{filename}"
137
+
138
+ filename = File.join(Kracker.diff_file_location, "#{test_root}__master_not_current__diff.yaml")
139
+ refute File.exists?(filename), "No master, not current, file should exist: #{filename}"
140
+
141
+ filename = Kracker.master_filename(test_root)
142
+ assert File.exists?(filename), "Master file should exist: #{filename}"
143
+
144
+ filename = Kracker.current_filename(test_root)
145
+ refute File.exists?(filename), "No current file should exist: #{filename}"
99
146
  end
100
147
 
101
148
  end
102
- end
149
+ end
data/test/test_helper.rb CHANGED
@@ -31,11 +31,13 @@ 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
+
34
35
  module Kracker
35
36
  class KrackerTestCase < Minitest::Test
37
+
36
38
  include Kracker
37
39
  include Kracker::TestObjects
38
40
  include Kracker::TestHelpers::Location
39
41
 
40
42
  end
41
- end
43
+ end