langalex-culerity 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.textile
CHANGED
@@ -31,11 +31,7 @@ Now (assuming you have a Rails application set up already) install Culerity as a
|
|
31
31
|
or as a gem: (definitely preferred)
|
32
32
|
|
33
33
|
gem install langalex-culerity
|
34
|
-
|
35
|
-
And add the culerity gem to your environment.rb:
|
36
|
-
|
37
|
-
config.gem 'langalex-culerity', :lib => 'culerity', :version => '0.1', :source => 'http://gems.github.com'
|
38
|
-
|
34
|
+
|
39
35
|
Run the RSpec, Cucumber and Culerity generators:
|
40
36
|
|
41
37
|
cd RAILS_ROOT
|
@@ -65,6 +61,9 @@ I get a broken pipe error:
|
|
65
61
|
I get _Connection Refused_ errors
|
66
62
|
* make sure you have started a server in the test environment that runs on port 80
|
67
63
|
|
64
|
+
My application can't find the data I create in my steps
|
65
|
+
* make sure you have disabled transactional fixtures in your env.rb
|
66
|
+
|
68
67
|
|
69
68
|
h2. Links to Celerity documentation
|
70
69
|
|
data/VERSION.yml
CHANGED
@@ -1,70 +1,72 @@
|
|
1
|
+
require 'culerity'
|
2
|
+
|
1
3
|
Before do
|
2
|
-
|
3
|
-
|
4
|
+
$server = Culerity::run_server
|
5
|
+
$browser = Culerity::RemoteBrowserProxy.new @server, {:browser => :firefox}
|
4
6
|
@host = 'http://localhost'
|
5
7
|
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
at_exit do
|
10
|
+
$browser.close
|
11
|
+
$browser.exit
|
12
|
+
$server.close
|
11
13
|
end
|
12
14
|
|
13
15
|
When /I press "(.*)"/ do |button|
|
14
|
-
|
16
|
+
$browser.button(:text, button).click
|
15
17
|
assert_successful_response
|
16
18
|
end
|
17
19
|
|
18
20
|
When /I follow "(.*)"/ do |link|
|
19
|
-
|
21
|
+
$browser.link(:text, /#{link}/).click
|
20
22
|
assert_successful_response
|
21
23
|
end
|
22
24
|
|
23
25
|
When /I fill in "(.*)" for "(.*)"/ do |value, field|
|
24
|
-
|
26
|
+
$browser.text_field(:id, find_label(field).for).set(value)
|
25
27
|
end
|
26
28
|
|
27
29
|
When /I check "(.*)"/ do |field|
|
28
|
-
|
30
|
+
$browser.check_box(:id, find_label(field).for).set(true)
|
29
31
|
end
|
30
32
|
|
31
33
|
When /^I uncheck "(.*)"$/ do |field|
|
32
|
-
|
34
|
+
$browser.check_box(:id, find_label(field).for).set(false)
|
33
35
|
end
|
34
36
|
|
35
37
|
When /I choose "(.*)"/ do |field|
|
36
|
-
|
38
|
+
$browser.radio(:id, find_label(field).for).set(true)
|
37
39
|
end
|
38
40
|
|
39
41
|
When /I go to "(.*)"/ do |path|
|
40
|
-
|
42
|
+
$browser.goto @host + path
|
41
43
|
assert_successful_response
|
42
44
|
end
|
43
45
|
|
44
46
|
When "I wait for the AJAX call to finish" do
|
45
|
-
|
47
|
+
$browser.page.getEnclosingWindow().getThreadManager().joinAll(10000)
|
46
48
|
end
|
47
49
|
|
48
50
|
|
49
51
|
Then /I should see "(.*)"/ do |text|
|
50
|
-
|
52
|
+
$browser.html.should =~ /#{text}/m
|
51
53
|
end
|
52
54
|
|
53
55
|
Then /I should not see "(.*)"/ do |text|
|
54
|
-
|
56
|
+
$browser.html.should_not =~ /#{text}/m
|
55
57
|
end
|
56
58
|
|
57
59
|
def find_label(text)
|
58
|
-
|
60
|
+
$browser.label :text, text
|
59
61
|
end
|
60
62
|
|
61
63
|
def assert_successful_response
|
62
|
-
status =
|
64
|
+
status = $browser.page.web_response.status_code
|
63
65
|
if(status == 302 || status == 301)
|
64
|
-
location =
|
66
|
+
location = $browser.page.web_response.get_response_header_value('Location')
|
65
67
|
puts "Being redirected to #{location}"
|
66
|
-
|
68
|
+
$browser.goto location
|
67
69
|
elsif status != 200
|
68
|
-
raise "Brower returned Response Code #{
|
70
|
+
raise "Brower returned Response Code #{$browser.page.web_response.status_code}"
|
69
71
|
end
|
70
72
|
end
|
@@ -17,7 +17,7 @@ module Culerity
|
|
17
17
|
result = target(call.first).send call[1], *call[2..-1]
|
18
18
|
_out << "[:return, #{proxify result}]\n"
|
19
19
|
rescue => e
|
20
|
-
_out << "[:exception,
|
20
|
+
_out << "[:exception, #{e.class.inspect}, #{e.message.inspect}, #{e.backtrace.inspect}]\n"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -71,7 +71,7 @@ describe Culerity::CelerityServer do
|
|
71
71
|
_in = stub 'in'
|
72
72
|
_in.stub!(:gets).and_return("[\"browser\", \"goto\", \"/homepage\"]\n", "[\"_exit_\"]\n")
|
73
73
|
_out = stub 'out'
|
74
|
-
_out.should_receive(:<<).with(
|
74
|
+
_out.should_receive(:<<).with(/^\[:exception, RuntimeError, \"test exception\", \[.*\]\]\n$/)
|
75
75
|
Culerity::CelerityServer.new(_in, _out)
|
76
76
|
end
|
77
77
|
end
|
@@ -15,11 +15,11 @@ describe Culerity::RemoteObjectProxy do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should raise the received exception" do
|
18
|
-
io = stub 'io', :gets => "[:exception,
|
18
|
+
io = stub 'io', :gets => "[:exception, RuntimeError, \"test exception\", []]", :<< => nil
|
19
19
|
proxy = Culerity::RemoteObjectProxy.new 345, io
|
20
20
|
lambda {
|
21
21
|
proxy.goto '/home'
|
22
|
-
}.should raise_error(RuntimeError, '
|
22
|
+
}.should raise_error(RuntimeError, 'test exception')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should send exit" do
|
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.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-
|
12
|
+
date: 2009-03-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|