protractor-rails 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/protractor/rails.rb +2 -1
- data/lib/protractor/rails/configuration.rb +41 -0
- data/lib/protractor/rails/version.rb +1 -1
- data/lib/tasks/install.rake +6 -6
- data/lib/tasks/protractor.rake +6 -6
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fc32fad5a4153160310ef39a668be0dde0f9e71
|
4
|
+
data.tar.gz: eebf81e2741edcd7ceee76f1da6af55fbee8657d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ae54f75fe47bcefe7568461f3ec31cb63f5b271c6f1db7f2fc65aebd7c4d306f0cf8efb29c20a99ad0f5cde76fa4b2c38ae19e75051b5150b54e765c65e63d
|
7
|
+
data.tar.gz: a29b92fec5364dd83d29f362c4c5af4f9ed3d0d735e193caa143964a7b35e1d3434dc662d76fde68dd8694fb17e25a548e245be3f6d16d0755c10221276ce9b6
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/protractor/rails.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Protractor
|
5
|
+
class << self
|
6
|
+
attr_accessor :configuration
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.load file_name
|
10
|
+
file_name = file_name
|
11
|
+
|
12
|
+
if File.exists? file_name
|
13
|
+
file = File.read file_name
|
14
|
+
yaml = ERB.new( file ).result
|
15
|
+
data = YAML.load yaml
|
16
|
+
end
|
17
|
+
|
18
|
+
return Configuration.new data
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configuration
|
22
|
+
@configuration ||= load 'config/protractor.yml'
|
23
|
+
end
|
24
|
+
|
25
|
+
class Configuration
|
26
|
+
attr_accessor :config_path,
|
27
|
+
:startup_timeout,
|
28
|
+
:port
|
29
|
+
|
30
|
+
def initialize ( data=nil )
|
31
|
+
@data = data
|
32
|
+
@config_path = get( :config_path ) || 'spec/javascripts/protractor.conf.js'
|
33
|
+
@startup_timeout = get( :startup_timeout ) || 6
|
34
|
+
@port = get( :port ) || 4000
|
35
|
+
end
|
36
|
+
|
37
|
+
def get *keys
|
38
|
+
keys.inject( @data ) { |result, key| result.try :[], key.to_s }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/tasks/install.rake
CHANGED
@@ -47,17 +47,17 @@ namespace :protractor do
|
|
47
47
|
puts "Create spec/javascripts directory".yellow
|
48
48
|
`mkdir spec/javascripts`
|
49
49
|
end
|
50
|
-
if !File.exist?
|
51
|
-
puts "Creating template configuration file in
|
52
|
-
template_path =
|
50
|
+
if !File.exist? Protractor.configuration.config_path
|
51
|
+
puts "Creating template configuration file in #{Protractor.configuration.config_path}".green
|
52
|
+
template_path = File.expand_path("../../../#{Protractor.configuration.config_path}", __FILE__)
|
53
53
|
template_conf = File.join(template_path, 'protractor.conf.js')
|
54
54
|
template_spec = File.join(template_path, 'example_spec.js')
|
55
|
-
system "cp #{template_conf}
|
56
|
-
puts "You will need to edit the
|
55
|
+
system "cp #{template_conf} #{Protractor.configuration.config_path}"
|
56
|
+
puts "You will need to edit the #{Protractor.configuration.config_path} file to suite your requirements."
|
57
57
|
system "cp #{template_spec} spec/javascripts/example_spec.js"
|
58
58
|
puts "created example_spec.js in spec/javascripts. You can test it out by running rake protractor:spec"
|
59
59
|
else
|
60
|
-
puts "You already have a configuration file. If you would like to start over, remove
|
60
|
+
puts "You already have a configuration file. If you would like to start over, remove #{Protractor.configuration.config_path} and run rake protractor:init".red
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/tasks/protractor.rake
CHANGED
@@ -17,7 +17,7 @@ namespace :protractor do |args|
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
desc "Run specs from
|
20
|
+
desc "Run specs from config file"
|
21
21
|
task :spec do
|
22
22
|
begin
|
23
23
|
options = ''
|
@@ -43,8 +43,8 @@ namespace :protractor do |args|
|
|
43
43
|
puts "webdriver PID: #{webdriver_pid}".yellow.bold
|
44
44
|
puts "Rails Server PID: #{rails_server_pid}".yellow.bold
|
45
45
|
puts "Waiting for servers to finish starting up...."
|
46
|
-
sleep
|
47
|
-
success = system "protractor #{options}
|
46
|
+
sleep Protractor.configuration.startup_timeout
|
47
|
+
success = system "protractor #{options} #{Protractor.configuration.config_path}"
|
48
48
|
Process.kill 'TERM', webdriver_pid
|
49
49
|
Process.kill 'TERM', rails_server_pid
|
50
50
|
Process.wait webdriver_pid
|
@@ -80,12 +80,12 @@ namespace :protractor do |args|
|
|
80
80
|
|
81
81
|
task :kill_rails do
|
82
82
|
puts "kill protractor rails tests server...".yellow
|
83
|
-
system "ps aux | grep -ie 'rails s -e test -P tmp/pids/protractor_test_server.pid --port
|
83
|
+
system "ps aux | grep -ie 'rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}' | awk '{print $2}' | xargs kill -9"
|
84
84
|
end
|
85
85
|
|
86
86
|
task :rails do
|
87
|
-
puts "Starting Rails server on port
|
88
|
-
rails_command = "rails s -e test -P tmp/pids/protractor_test_server.pid --port
|
87
|
+
puts "Starting Rails server on port #{Protractor.configuration.port} pid file in tmp/pids/protractor_test_server.pid".green
|
88
|
+
rails_command = "rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}"
|
89
89
|
if ENV['rails_binding'] != nil
|
90
90
|
rails_command << " --binding #{ ENV['rails_binding'] }"
|
91
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protractor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyrone Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- lib/protractor-rails.rb
|
84
84
|
- lib/protractor/rails.rb
|
85
|
+
- lib/protractor/rails/configuration.rb
|
85
86
|
- lib/protractor/rails/railtie.rb
|
86
87
|
- lib/protractor/rails/version.rb
|
87
88
|
- lib/tasks/install.rake
|
@@ -111,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
112
|
version: '0'
|
112
113
|
requirements: []
|
113
114
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.4.2
|
115
116
|
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: Seemlessly run protractor for angularjs in your rails app.
|