ojo 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -2
- data/lib/ojo.rb +1 -0
- data/lib/ojo/version.rb +1 -1
- data/lib/tasks/ojo.rake +2 -3
- data/test/phantom/browser_test.rb +3 -0
- data/test/phantom_test_helper.rb +5 -10
- data/test/test_app/Gemfile.lock +1 -1
- data/test/unit/manager_test.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc965e4b05eb265b42f3fc22c46f5898222a3fb4
|
4
|
+
data.tar.gz: 19f1b43550134f0982c9dd5030b6702a510d6ee5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d09e1f5ff347541cb6909029a886f7f55ee840b07514a7ed16e68eac05e12480b3530cb2f72cfe9f206362f347594f967b93f5a337970b8982aa8c067ea1e2
|
7
|
+
data.tar.gz: 0c891cfee69440cdf3f8c8b82badd7029c137aae5875cbbb6d400e89cd11e6a66923cfa61398842c4f0a8d6b7c4e78c5206762769ed00aeb0de7b2024672cfbe
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
4
|
|
5
5
|
require 'ojo'
|
6
6
|
|
@@ -12,8 +12,16 @@ namespace :test do
|
|
12
12
|
t.pattern = 'test/unit/**/*_test.rb'
|
13
13
|
t.verbose = false
|
14
14
|
end
|
15
|
+
|
16
|
+
desc 'phantom js'
|
17
|
+
Rake::TestTask.new :phantom do |t|
|
18
|
+
t.libs << '.'
|
19
|
+
t.libs << 'test'
|
20
|
+
t.pattern = 'test/phantom/**/*_test.rb'
|
21
|
+
t.verbose = false
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
17
|
-
task :test =>
|
25
|
+
task :test => %w(test:units test:phantom)
|
18
26
|
|
19
27
|
task :default => :test
|
data/lib/ojo.rb
CHANGED
data/lib/ojo/version.rb
CHANGED
data/lib/tasks/ojo.rake
CHANGED
@@ -3,8 +3,8 @@ require 'fileutils'
|
|
3
3
|
namespace :ojo do
|
4
4
|
desc 'use ojo to compare two branches'
|
5
5
|
task :compare, [:branch_1, :branch_2] => :environment do |t, args|
|
6
|
-
branch_1 = args
|
7
|
-
branch_2 = args
|
6
|
+
branch_1 = args[:branch_1]
|
7
|
+
branch_2 = args[:branch_2]
|
8
8
|
|
9
9
|
Ojo::Manager.new.compare(branch_1, branch_2)
|
10
10
|
end
|
@@ -29,6 +29,5 @@ namespace :ojo do
|
|
29
29
|
task :all => :environment do |t|
|
30
30
|
Ojo::Manager.new.clear_all
|
31
31
|
end
|
32
|
-
|
33
32
|
end
|
34
33
|
end
|
@@ -4,5 +4,8 @@ class TestAppTest < OjoApp::PhantomTestCase
|
|
4
4
|
def test_index_page
|
5
5
|
PageObjects::TestApp::IndexPage.visit
|
6
6
|
Ojo.screenshot(branch_name, __method__)
|
7
|
+
|
8
|
+
expected_screenshot_file = File.join(Ojo.configuration.location, branch_name, "#{__method__}.png")
|
9
|
+
assert File.exist?(expected_screenshot_file), "the ojo screen shot file #{expected_screenshot_file} exists"
|
7
10
|
end
|
8
11
|
end
|
data/test/phantom_test_helper.rb
CHANGED
@@ -32,7 +32,6 @@ require 'page_objects'
|
|
32
32
|
Capybara.default_driver = :poltergeist
|
33
33
|
Capybara.javascript_driver = :poltergeist
|
34
34
|
|
35
|
-
|
36
35
|
module OjoApp
|
37
36
|
class PhantomTestCase < Minitest::Test
|
38
37
|
include Capybara::DSL
|
@@ -40,28 +39,24 @@ module OjoApp
|
|
40
39
|
def setup
|
41
40
|
Ojo.screenshotter = lambda do |filename|
|
42
41
|
page.save_screenshot(filename)
|
43
|
-
puts "Screenshot taken and saved to #{filename}"
|
44
42
|
end
|
45
43
|
Capybara.reset!
|
46
44
|
end
|
47
45
|
|
48
46
|
def teardown
|
49
47
|
Capybara.reset!
|
48
|
+
remove_test_screenshots
|
50
49
|
end
|
51
50
|
|
52
51
|
private
|
53
52
|
|
54
|
-
def screenshot_path
|
55
|
-
File.join(Rails.root, 'tmp', 'screenshots')
|
56
|
-
end
|
57
|
-
|
58
|
-
def screenshot_file(name)
|
59
|
-
File.join(screenshot_path, branch_name, "#{name}.png")
|
60
|
-
end
|
61
|
-
|
62
53
|
def branch_name
|
63
54
|
`git rev-parse --abbrev-ref HEAD`.chomp
|
64
55
|
end
|
65
56
|
|
57
|
+
def remove_test_screenshots
|
58
|
+
branch_location = File.join(Ojo.configuration.location, branch_name)
|
59
|
+
FileUtils.rm_rf branch_location
|
60
|
+
end
|
66
61
|
end
|
67
62
|
end
|
data/test/test_app/Gemfile.lock
CHANGED
data/test/unit/manager_test.rb
CHANGED
@@ -112,6 +112,13 @@ class ManagerTest < Ojo::OjoTestCase
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
assert_compare_output out.string, %w(branch_1 branch_1a)
|
115
|
+
|
116
|
+
out = capture_output do
|
117
|
+
Date.stub :today, Date.parse('1/10/2014') do
|
118
|
+
@manager.compare branch_1_name, branch_2_name
|
119
|
+
end
|
120
|
+
end
|
121
|
+
assert_compare_output out.string, %w(branch_1 branch_2)
|
115
122
|
end
|
116
123
|
|
117
124
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ojo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geordie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|