langalex-culerity 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README.textile +13 -0
- data/VERSION.yml +1 -1
- data/culerity.gemspec +6 -6
- data/lib/culerity/celerity_server.rb +5 -3
- data/lib/culerity/remote_browser_proxy.rb +32 -1
- data/lib/culerity/remote_object_proxy.rb +16 -0
- data/spec/celerity_server_spec.rb +1 -1
- data/spec/remote_browser_proxy_spec.rb +28 -0
- metadata +5 -4
data/.gitignore
ADDED
data/README.textile
CHANGED
@@ -67,6 +67,19 @@ I get _Connection Refused_ errors
|
|
67
67
|
My application can't find the data I create in my steps
|
68
68
|
* make sure you have disabled transactional fixtures in your env.rb
|
69
69
|
|
70
|
+
My database is not cleared automatically between scenarios
|
71
|
+
* Rails can't clean the database because you had to disable transactional fixtures - which only work if your test process is the same as your web server process. Hence you have to clean your database manually. A quick way would be:
|
72
|
+
|
73
|
+
<pre><code>Before do
|
74
|
+
[User, .... all your models].each do |model|
|
75
|
+
mode.delete_all
|
76
|
+
end
|
77
|
+
end
|
78
|
+
</code></pre>
|
79
|
+
|
80
|
+
I want to test emails but the ActionMailer::Base.deliveries array is always empty.
|
81
|
+
* that's because the :test delivery method stores all emails in memory, but now that your test process is not the same as your rails process you don't have access to that array. install the http://github.com/ngty/action_mailer_cache_delivery plugin to access the emails in your rails process via a temporary file
|
82
|
+
|
70
83
|
|
71
84
|
h2. Links to Celerity documentation
|
72
85
|
|
data/VERSION.yml
CHANGED
data/culerity.gemspec
CHANGED
@@ -2,18 +2,19 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{culerity}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.7"
|
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-
|
9
|
+
s.date = %q{2009-06-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 = [
|
13
13
|
"README.textile"
|
14
14
|
]
|
15
15
|
s.files = [
|
16
|
-
"
|
16
|
+
".gitignore",
|
17
|
+
"MIT-LICENSE",
|
17
18
|
"README.textile",
|
18
19
|
"Rakefile",
|
19
20
|
"VERSION.yml",
|
@@ -31,11 +32,10 @@ Gem::Specification.new do |s|
|
|
31
32
|
"spec/remote_object_proxy_spec.rb",
|
32
33
|
"spec/spec_helper.rb"
|
33
34
|
]
|
34
|
-
s.has_rdoc = true
|
35
35
|
s.homepage = %q{http://github.com/langalex/culerity}
|
36
36
|
s.rdoc_options = ["--charset=UTF-8"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.3.
|
38
|
+
s.rubygems_version = %q{1.3.4}
|
39
39
|
s.summary = %q{Culerity integrates Cucumber and Celerity in order to test your application's full stack.}
|
40
40
|
s.test_files = [
|
41
41
|
"spec/celerity_server_spec.rb",
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
|
47
47
|
if s.respond_to? :specification_version then
|
48
48
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
-
s.specification_version =
|
49
|
+
s.specification_version = 3
|
50
50
|
|
51
51
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
52
|
s.add_runtime_dependency(%q<cucumber>, [">= 0"])
|
@@ -44,9 +44,11 @@ module Culerity
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def proxify(result)
|
48
|
-
if
|
49
|
-
result.inspect
|
47
|
+
def proxify(result, in_array = false)
|
48
|
+
if result.is_a?(Array)
|
49
|
+
result.map {|x| proxify(x, true) }.inspect
|
50
|
+
elsif [String, TrueClass, FalseClass, Fixnum, Float, NilClass].include?(result.class)
|
51
|
+
in_array ? result : result.inspect
|
50
52
|
else
|
51
53
|
@proxies[result.object_id] = result
|
52
54
|
"Culerity::RemoteObjectProxy.new(#{result.object_id}, @io)"
|
@@ -8,7 +8,38 @@ module Culerity
|
|
8
8
|
configure_browser browser_options
|
9
9
|
@remote_object_id = nil
|
10
10
|
end
|
11
|
-
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Calls the block until it returns true or +time_to_wait+ is reached.
|
15
|
+
# +time_to_wait+ is 30 seconds by default
|
16
|
+
#
|
17
|
+
# Returns true upon success
|
18
|
+
# Raises Timeout::Error when +time_to_wait+ is reached.
|
19
|
+
#
|
20
|
+
def wait_until time_to_wait=30, &block
|
21
|
+
Timeout.timeout(time_to_wait) do
|
22
|
+
until block.call
|
23
|
+
sleep 0.1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Calls the block until it doesn't return true or +time_to_wait+ is reached.
|
31
|
+
# +time_to_wait+ is 30 seconds by default
|
32
|
+
#
|
33
|
+
# Returns true upon success
|
34
|
+
# Raises Timeout::Error when +time_to_wait+ is reached.
|
35
|
+
#
|
36
|
+
def wait_while time_to_wait=30, &block
|
37
|
+
Timeout.timeout(time_to_wait) do
|
38
|
+
while block.call
|
39
|
+
sleep 0.1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
true
|
12
43
|
end
|
13
44
|
|
14
45
|
private
|
@@ -13,7 +13,23 @@ module Culerity
|
|
13
13
|
@io = io
|
14
14
|
end
|
15
15
|
|
16
|
+
#
|
17
|
+
# Commonly used to get the HTML id attribute
|
18
|
+
# Use `object_id` to get the local objects' id.
|
19
|
+
#
|
20
|
+
def id
|
21
|
+
send_remote(:id)
|
22
|
+
end
|
23
|
+
|
16
24
|
def method_missing(name, *args)
|
25
|
+
send_remote(name, *args)
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Calls the passed method on the remote object with any arguments specified.
|
30
|
+
# Behaves the same as <code>Object#send</code>.
|
31
|
+
#
|
32
|
+
def send_remote(name, *args)
|
17
33
|
@io << "[#{remote_object_id}, \"#{name}\", #{args.map{|a| a.inspect}.join(', ')}]\n"
|
18
34
|
process_result @io.gets.to_s.strip
|
19
35
|
end
|
@@ -54,7 +54,7 @@ describe Culerity::CelerityServer do
|
|
54
54
|
_in = stub 'in'
|
55
55
|
_in.stub!(:gets).and_return('["celerity", "configure_browser", {:browser=>:firefox}]' + "\n", '["browser", "goto", "/homepage"]' + "\n", "[\"_exit_\"]\n")
|
56
56
|
Celerity::Browser.should_receive(:new).with(:browser => :firefox)
|
57
|
-
Culerity::CelerityServer.new(_in,
|
57
|
+
Culerity::CelerityServer.new(_in, stub.as_null_object)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should pass multiple method calls" do
|
@@ -20,4 +20,32 @@ describe Culerity::RemoteBrowserProxy do
|
|
20
20
|
proxy = Culerity::RemoteBrowserProxy.new io, {:browser => :firefox}
|
21
21
|
end
|
22
22
|
|
23
|
+
it "should timeout if wait_until takes too long" do
|
24
|
+
io = stub 'io', :gets => "[:return, :okay]", :<< => nil
|
25
|
+
proxy = Culerity::RemoteBrowserProxy.new io
|
26
|
+
lambda {
|
27
|
+
proxy.wait_until(1) { false }
|
28
|
+
}.should raise_error(Timeout::Error)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return successfully when wait_until returns true" do
|
32
|
+
io = stub 'io', :gets => "[:return, :okay]", :<< => nil
|
33
|
+
proxy = Culerity::RemoteBrowserProxy.new io
|
34
|
+
proxy.wait_until(1) { true }.should == true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should timeout if wait_while takes too long" do
|
38
|
+
io = stub 'io', :gets => "[:return, :okay]", :<< => nil
|
39
|
+
proxy = Culerity::RemoteBrowserProxy.new io
|
40
|
+
lambda {
|
41
|
+
proxy.wait_while(1) { true }
|
42
|
+
}.should raise_error(Timeout::Error)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return successfully when wait_while returns !true" do
|
46
|
+
io = stub 'io', :gets => "[:return, :okay]", :<< => nil
|
47
|
+
proxy = Culerity::RemoteBrowserProxy.new io
|
48
|
+
proxy.wait_while(1) { false }.should == true
|
49
|
+
end
|
50
|
+
|
23
51
|
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.1.
|
4
|
+
version: 0.1.7
|
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-
|
12
|
+
date: 2009-06-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -41,6 +41,7 @@ extensions: []
|
|
41
41
|
extra_rdoc_files:
|
42
42
|
- README.textile
|
43
43
|
files:
|
44
|
+
- .gitignore
|
44
45
|
- MIT-LICENSE
|
45
46
|
- README.textile
|
46
47
|
- Rakefile
|
@@ -58,7 +59,7 @@ files:
|
|
58
59
|
- spec/remote_browser_proxy_spec.rb
|
59
60
|
- spec/remote_object_proxy_spec.rb
|
60
61
|
- spec/spec_helper.rb
|
61
|
-
has_rdoc:
|
62
|
+
has_rdoc: false
|
62
63
|
homepage: http://github.com/langalex/culerity
|
63
64
|
post_install_message:
|
64
65
|
rdoc_options:
|
@@ -82,7 +83,7 @@ requirements: []
|
|
82
83
|
rubyforge_project:
|
83
84
|
rubygems_version: 1.2.0
|
84
85
|
signing_key:
|
85
|
-
specification_version:
|
86
|
+
specification_version: 3
|
86
87
|
summary: Culerity integrates Cucumber and Celerity in order to test your application's full stack.
|
87
88
|
test_files:
|
88
89
|
- spec/celerity_server_spec.rb
|