langalex-culerity 0.2.2 → 0.2.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.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 2
3
- :patch: 2
4
2
  :major: 0
3
+ :minor: 2
4
+ :patch: 3
data/culerity.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{culerity}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alexander Lang"]
9
- s.date = %q{2009-08-16}
9
+ s.date = %q{2009-09-08}
10
10
  s.description = %q{Culerity integrates Cucumber and Celerity in order to test your application's full stack.}
11
11
  s.email = %q{alex@upstream-berlin.com}
12
12
  s.extra_rdoc_files = [
@@ -21,8 +21,10 @@ Gem::Specification.new do |s|
21
21
  "culerity.gemspec",
22
22
  "features/fixtures/sample_feature",
23
23
  "features/installing_culerity.feature",
24
+ "features/running_cucumber_without_explicitly_running_external_services.feature",
24
25
  "features/step_definitions/common_steps.rb",
25
26
  "features/step_definitions/culerity_setup_steps.rb",
27
+ "features/step_definitions/jruby_steps.rb",
26
28
  "features/step_definitions/rails_setup_steps.rb",
27
29
  "features/support/common.rb",
28
30
  "features/support/env.rb",
@@ -49,7 +51,7 @@ Gem::Specification.new do |s|
49
51
  s.homepage = %q{http://github.com/langalex/culerity}
50
52
  s.rdoc_options = ["--charset=UTF-8"]
51
53
  s.require_paths = ["lib"]
52
- s.rubygems_version = %q{1.3.3}
54
+ s.rubygems_version = %q{1.3.5}
53
55
  s.summary = %q{Culerity integrates Cucumber and Celerity in order to test your application's full stack.}
54
56
  s.test_files = [
55
57
  "spec/celerity_server_spec.rb",
@@ -12,7 +12,6 @@ Feature: Installing culerity
12
12
  When I run executable "script/generate" with arguments "culerity"
13
13
  And I setup load path to local code
14
14
 
15
-
16
15
  Scenario: Install culerity and setup jruby environment
17
16
  Given I have jruby installed
18
17
  When I invoke task "rake culerity:install"
@@ -39,6 +38,7 @@ Feature: Installing culerity
39
38
  And I run executable "cucumber" with arguments "features/"
40
39
  Then I should see "1 scenario"
41
40
  And I should see "5 steps (5 passed)"
41
+ And I should not see "WARNING: Speed up executing by running 'rake culerity:rails:start'"
42
42
 
43
43
 
44
44
 
@@ -0,0 +1,24 @@
1
+ Feature: Running cucumber without explicitly running external services
2
+ In order to reduce learning cost of using culerity
3
+ As a rails developer
4
+ I want the headless browser and rails processes to launch and shutdown automatically
5
+
6
+ Background:
7
+ Given a Rails app
8
+ And I run executable "script/generate" with arguments "cucumber"
9
+ And I delete file "features/step_definitions/webrat_steps.rb"
10
+ And I copy the project generators into "vendor/generators"
11
+ And I invoke task "rake db:migrate"
12
+ When I run executable "script/generate" with arguments "culerity"
13
+ And I setup load path to local code
14
+
15
+ Scenario: Successfully run scenarios without requiring celerity or rails processes running
16
+ When I add a feature file to test Rails index.html default file
17
+ And I run executable "cucumber" with arguments "features/"
18
+ Then file "tmp/culerity_rails_server.pid" is not created
19
+ And I should see "1 scenario"
20
+ And I should see "5 steps (5 passed)"
21
+ And I should see "WARNING: Speed up execution by running 'rake culerity:rails:start'"
22
+
23
+
24
+
@@ -110,6 +110,10 @@ Then /^I should see "([^\"]*)"$/ do |text|
110
110
  actual_output.should contain(text)
111
111
  end
112
112
 
113
+ Then /^I should not see "([^\"]*)"$/ do |text|
114
+ actual_output = File.read(@stdout)
115
+ actual_output.should_not contain(text)
116
+ end
113
117
 
114
118
  Then /^I should see$/ do |text|
115
119
  actual_output = File.read(@stdout)
@@ -0,0 +1,11 @@
1
+ Given /^I have jruby installed$/ do
2
+ @jruby_cmd = `which jruby`.strip
3
+ raise "Need to setup @jruby_cmd to test jruby environment" if @jruby_cmd.blank?
4
+ end
5
+
6
+ Then /^the gem "([^\"]*)" is installed into jruby environment$/ do |gem_name|
7
+ raise "Need to setup @jruby_cmd to test jruby environment" if @jruby_cmd.blank?
8
+ gem_list = `#{@jruby_cmd} -S gem list #{gem_name}`
9
+ gem_list.should =~ /#{gem_name}/
10
+ end
11
+
@@ -19,18 +19,8 @@ When /^I add a feature file to test Rails index.html default file$/ do
19
19
  end
20
20
  end
21
21
 
22
- Given /^I run the rails server in environment "([^\"]*)"$/ do |environment|
23
- in_project_folder do
24
- $rails_server ||= IO.popen("script/server -e #{environment} -p 3001", 'r+')
25
- File.open("tmp/culerity_rails_server.pid", "w") { |file| file << $rails_server.pid; file.flush }
26
- end
27
- end
28
-
29
22
  After do
30
23
  in_project_folder do
31
24
  Given 'I invoke task "rake culerity:rails:stop"'
32
25
  end
33
26
  end
34
-
35
- # rake culerity:rails:start [RAILS=culerity_development]
36
- # rake culerity:rails:stop
data/lib/culerity.rb CHANGED
@@ -6,7 +6,7 @@ module Culerity
6
6
  module ServerCommands
7
7
  def exit_server
8
8
  self << '["_exit_"]'
9
- close
9
+ Process.kill(6, self.pid.to_i)
10
10
  end
11
11
 
12
12
  def close_browsers
@@ -32,6 +32,15 @@ module Culerity
32
32
  # open named pipes to communicate with celerity_server + return them
33
33
  end
34
34
 
35
+ def self.run_rails
36
+ unless File.exists?("tmp/culerity_rails_server.pid")
37
+ puts "WARNING: Speed up execution by running 'rake culerity:rails:start'"
38
+ port = 3001
39
+ environment = 'culerity_development'
40
+ puts "Launched rails on :#{port}..."
41
+ return IO.popen("script/server -e #{environment} -p #{port}", 'r+')
42
+ end
43
+ end
35
44
  end
36
45
 
37
46
  if __FILE__ == $0
@@ -1,6 +1,8 @@
1
1
  require 'culerity'
2
2
 
3
3
  Before do
4
+ $rails_server ||= Culerity::run_rails
5
+ sleep 5
4
6
  $server ||= Culerity::run_server
5
7
  $browser = Culerity::RemoteBrowserProxy.new $server, {:browser => :firefox}
6
8
  @host = 'http://localhost:3001'
@@ -8,7 +10,8 @@ end
8
10
 
9
11
  at_exit do
10
12
  $browser.exit if $browser
11
- $server.close if $server
13
+ $server.exit_server if $server
14
+ Process.kill(6, $rails_server.pid.to_i) if $rails_server
12
15
  end
13
16
 
14
17
  When /I press "(.*)"/ do |button|
@@ -84,4 +87,4 @@ def assert_successful_response
84
87
  `open -a /Applications/Safari.app #{tmp.path}`
85
88
  raise "Brower returned Response Code #{$browser.page.web_response.status_code}"
86
89
  end
87
- end
90
+ end
@@ -2,13 +2,14 @@ namespace 'culerity' do
2
2
  namespace 'rails' do
3
3
  desc "Starts a rails server for cucumber/culerity tests"
4
4
  task :start => :environment do
5
+ port = ENV['PORT'] || 3001
5
6
  environment = 'culerity_development'
6
7
  pid_file = RAILS_ROOT + "/tmp/culerity_rails_server.pid"
7
8
  if File.exists?(pid_file)
8
9
  puts "culerity rails server already running; if not, delete tmp/culerity_rails_server.pid and try again"
9
10
  exit 1
10
11
  end
11
- rails_server = IO.popen("script/server -e #{environment} -p 3001", 'r+')
12
+ rails_server = IO.popen("script/server -e #{environment} -p #{port}", 'r+')
12
13
  File.open(pid_file, "w") { |file| file << rails_server.pid }
13
14
  end
14
15
 
@@ -23,12 +24,15 @@ namespace 'culerity' do
23
24
  puts "No culerity rails server running. Doing nothing."
24
25
  end
25
26
  end
27
+
28
+ desc "Restarts the rails server for cucumber/culerity tests"
29
+ task :restart => [:stop, :start]
26
30
  end
27
31
 
28
32
  desc "Install required gems into jruby"
29
33
  task :install => :environment do
30
- jgem_cmd = `which jgem`.strip
34
+ jgem_cmd = `which jruby`.strip
31
35
  raise "ERROR: You need to install jruby to use culerity and celerity." if jgem_cmd.blank?
32
- sh "#{jgem_cmd} install jarib-celerity --source=http://gems.github.com"
36
+ sh "#{jgem_cmd} -S gem install jarib-celerity --source=http://gems.github.com"
33
37
  end
34
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: langalex-culerity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-16 00:00:00 -07:00
12
+ date: 2009-09-08 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,8 +49,10 @@ files:
49
49
  - culerity.gemspec
50
50
  - features/fixtures/sample_feature
51
51
  - features/installing_culerity.feature
52
+ - features/running_cucumber_without_explicitly_running_external_services.feature
52
53
  - features/step_definitions/common_steps.rb
53
54
  - features/step_definitions/culerity_setup_steps.rb
55
+ - features/step_definitions/jruby_steps.rb
54
56
  - features/step_definitions/rails_setup_steps.rb
55
57
  - features/support/common.rb
56
58
  - features/support/env.rb