cappie 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -37,10 +37,11 @@ An instant capybara/cucumber/rspec/selenium-webdriver configuration for web apps
37
37
  await: /listening at 8080/,
38
38
  host: 'http://localhost:8080',
39
39
  driver: :poltergeist,
40
- environment: { variable: 'value' }
40
+ environment: { variable: 'value' },
41
+ working_dir: '/some/dir'
41
42
  )
42
43
 
43
- (driver and environment are optional)
44
+ (driver, environment and working_dir are optional)
44
45
 
45
46
  ## Usage
46
47
 
data/cappie.gemspec CHANGED
@@ -13,13 +13,13 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.platform = Gem::Platform::RUBY
15
15
 
16
- s.add_runtime_dependency 'cucumber', '>= 1.2.1'
17
- s.add_runtime_dependency 'capybara', '>= 2.0.2'
18
- s.add_runtime_dependency 'childprocess', '>= 0.3.8'
19
- s.add_runtime_dependency 'rspec-expectations', '>= 2.0.1'
16
+ s.add_runtime_dependency 'cucumber', '>= 1.3.16'
17
+ s.add_runtime_dependency 'capybara', '>= 2.4.1'
18
+ s.add_runtime_dependency 'procession', '>= 0.0.1'
19
+ s.add_runtime_dependency 'rspec-expectations', '>= 3.0.4'
20
20
  s.add_runtime_dependency 'selenium-webdriver', '>= 2.29.0'
21
- s.add_runtime_dependency 'poltergeist', '>= 1.1.1'
22
-
21
+ s.add_runtime_dependency 'poltergeist', '>= 1.5.1'
22
+
23
23
  s.add_development_dependency 'rack', '>= 1.5.2'
24
24
 
25
25
  s.rubygems_version = ">= 1.6.1"
@@ -3,10 +3,10 @@ When /^I open my app$/ do
3
3
  end
4
4
 
5
5
  Then /^my client\-side script is executed$/ do
6
- page.should have_content("text created by client-side script")
6
+ expect(page).to have_content("text created by client-side script")
7
7
  end
8
8
 
9
9
  Then /^I see the environment variables$/ do
10
- page.should have_content("foo")
11
- page.should have_content("bar")
10
+ expect(page).to have_content("foo")
11
+ expect(page).to have_content("bar")
12
12
  end
@@ -1,10 +1,10 @@
1
1
  require_relative '../../../lib/cappie'
2
2
 
3
3
  app_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "app"))
4
- app_path = File.expand_path(File.join(app_dir, "config.ru"))
5
4
 
6
5
  Cappie.start(
7
- command: "bundle exec rackup #{app_path}",
6
+ working_dir: app_dir,
7
+ command: "bundle exec rackup",
8
8
  await: /9292/,
9
9
  host: "http://localhost:9292",
10
10
  environment: {foo: 'bar'},
data/lib/cappie.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
2
 
3
3
  require 'cappie/version'
4
- require 'cappie/process'
5
4
  require 'cappie/driver'
5
+ require 'procession'
6
6
 
7
7
  module Cappie
8
8
  def self.start(options)
9
9
  host = options.delete(:host)
10
10
  driver = options.delete(:driver) || :selenium
11
- Process.new(options).start
11
+ Procession::Process.new(options).start
12
12
  Driver.new(driver, host)
13
13
  end
14
14
  end
@@ -1,3 +1,3 @@
1
1
  module Cappie
2
- VERSION = '0.0.2'
3
- end
2
+ VERSION = '0.0.4'
3
+ end
metadata CHANGED
@@ -1,111 +1,126 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cappie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Josh Chisholm
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-05-17 00:00:00.000000000 Z
12
+ date: 2014-08-16 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: cucumber
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
- version: 1.2.1
21
+ version: 1.3.16
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
- version: 1.2.1
29
+ version: 1.3.16
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: capybara
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
- version: 2.0.2
37
+ version: 2.4.1
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
- version: 2.0.2
45
+ version: 2.4.1
41
46
  - !ruby/object:Gem::Dependency
42
- name: childprocess
47
+ name: procession
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
- version: 0.3.8
53
+ version: 0.0.1
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
- version: 0.3.8
61
+ version: 0.0.1
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec-expectations
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
- version: 2.0.1
69
+ version: 3.0.4
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
- version: 2.0.1
77
+ version: 3.0.4
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: selenium-webdriver
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: 2.29.0
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: 2.29.0
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: poltergeist
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
- version: 1.1.1
101
+ version: 1.5.1
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
- version: 1.1.1
109
+ version: 1.5.1
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: rack
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: 1.5.2
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: 1.5.2
111
126
  description: Instant capybara/cucumber/rspec/selenium-webdriver configuration for
@@ -124,34 +139,31 @@ files:
124
139
  - example/features/support/env.rb
125
140
  - lib/cappie.rb
126
141
  - lib/cappie/driver.rb
127
- - lib/cappie/process.rb
128
142
  - lib/cappie/version.rb
129
- - spec/cappie/example_app.rb
130
- - spec/cappie/process_spec.rb
131
143
  homepage: http://github.com/featurist/cappie
132
144
  licenses: []
133
- metadata: {}
134
145
  post_install_message:
135
146
  rdoc_options:
136
147
  - --charset=UTF-8
137
148
  require_paths:
138
149
  - lib
139
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
140
152
  requirements:
141
- - - '>='
153
+ - - ! '>='
142
154
  - !ruby/object:Gem::Version
143
155
  version: '0'
144
156
  required_rubygems_version: !ruby/object:Gem::Requirement
157
+ none: false
145
158
  requirements:
146
- - - '>='
159
+ - - ! '>='
147
160
  - !ruby/object:Gem::Version
148
161
  version: '0'
149
162
  requirements: []
150
163
  rubyforge_project:
151
- rubygems_version: 2.0.3
164
+ rubygems_version: 1.8.24
152
165
  signing_key:
153
- specification_version: 4
154
- summary: cappie-0.0.2
155
- test_files:
156
- - spec/cappie/example_app.rb
157
- - spec/cappie/process_spec.rb
166
+ specification_version: 3
167
+ summary: cappie-0.0.4
168
+ test_files: []
169
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: f5c6ba37d4f3d93fdbcdae68a68aeded6587fd95
4
- data.tar.gz: 70135c802bd6c61024e91f138b723d86059672a9
5
- SHA512:
6
- metadata.gz: 78b27d92da3917984e9e36c0df919b6f926618baab8707805740c88dbf81a076c3c28cdc66441d133c4835e217d41a6358caf024c5dca591a0b9c8edd3003215
7
- data.tar.gz: d93f25f78ba7ff0987fbabd901d5fe7f2d7630d369e83ca1eecee703b0078b215ff5d60d556da10e42523fcd081d8d7fcc52e68d11b4b30ab38cea82f3b5f83a
@@ -1,70 +0,0 @@
1
- require 'childprocess'
2
-
3
- module Cappie
4
- class Process
5
- def initialize(options)
6
- @command = options.delete(:command)
7
- @await = options.delete(:await)
8
- @working_dir = options.delete(:working_dir)
9
- @environment = options.delete(:environment)
10
- end
11
-
12
- def start
13
- args = @command.split(' ')
14
- @proc = ChildProcess.build(*args)
15
-
16
- setup_cwd
17
- setup_environment
18
-
19
- r, w = IO.pipe
20
-
21
- @proc.io.stdout = @proc.io.stderr = w
22
-
23
- @proc.start
24
- w.close
25
-
26
- all_output = ""
27
-
28
- begin
29
- started = false
30
- until started
31
- partial = r.readpartial(8192)
32
- puts partial if ENV['CAPPIE_DEBUG']
33
- all_output << partial
34
- if (all_output =~ @await)
35
- started = true
36
- end
37
- end
38
- rescue EOFError
39
- raise ProcessExitedError.new "The app process exited\nSTDOUT:\n#{all_output}"
40
- end
41
-
42
- Thread.new do
43
- while true
44
- partial = r.readpartial(8192)
45
- puts partial if ENV['CAPPIE_DEBUG']
46
- end
47
- end
48
-
49
- at_exit do
50
- @proc.stop
51
- end
52
-
53
- @proc.io.inherit!
54
-
55
- @proc
56
- end
57
-
58
- private
59
-
60
- def setup_environment
61
- @environment.each { |key, value| @proc.environment[key] = value } unless @environment.nil?
62
- end
63
-
64
- def setup_cwd
65
- @proc.cwd = @working_dir unless @working_dir.nil?
66
- end
67
- end
68
-
69
- class ProcessExitedError < RuntimeError; end
70
- end
@@ -1,5 +0,0 @@
1
- puts 'app started'
2
- puts Dir.pwd
3
- puts ENV['FOO']
4
- $stdout.flush
5
- sleep 1
@@ -1,42 +0,0 @@
1
- require_relative '../../lib/cappie/process'
2
-
3
- module Cappie
4
-
5
- describe Process do
6
-
7
- def example_app_path
8
- File.join(File.dirname(__FILE__), "example_app.rb")
9
- end
10
-
11
- it 'runs a process and awaits some output' do
12
- process = Process.new(command: "ruby #{example_app_path}", await: /#{Dir.pwd}/).start
13
- process.should be_alive
14
- process.stop
15
- end
16
-
17
- it 'sets environment variables' do
18
- process = Process.new(command: "ruby #{example_app_path}", environment: { FOO: 'omg' }, await: /omg/).start
19
- process.should be_alive
20
- process.stop
21
- end
22
-
23
- it 'accepts a working directory' do
24
- dir = File.dirname(__FILE__)
25
- Dir.chdir dir do
26
- process = Process.new(command: "ruby #{example_app_path}", await: /#{dir}/).start
27
- process.should be_alive
28
- process.stop
29
- end
30
- end
31
-
32
- describe 'when the process exits' do
33
- it 'raises an exception with the stdout output' do
34
- lambda {
35
- Process.new(command: 'pwd').start
36
- }.should raise_error("The app process exited\nSTDOUT:\n#{Dir.pwd}\n")
37
- end
38
- end
39
-
40
- end
41
-
42
- end