langalex-culerity 0.1.2 → 0.1.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/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,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
@@ -1,70 +1,72 @@
1
+ require 'culerity'
2
+
1
3
  Before do
2
- @server = Culerity::run_server
3
- @browser = Culerity::RemoteBrowserProxy.new @server, {:browser => :firefox}
4
+ $server = Culerity::run_server
5
+ $browser = Culerity::RemoteBrowserProxy.new @server, {:browser => :firefox}
4
6
  @host = 'http://localhost'
5
7
  end
6
8
 
7
- After do
8
- @browser.close
9
- @browser.exit
10
- @server.close
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
- @browser.button(:text, button).click
16
+ $browser.button(:text, button).click
15
17
  assert_successful_response
16
18
  end
17
19
 
18
20
  When /I follow "(.*)"/ do |link|
19
- @browser.link(:text, /#{link}/).click
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
- @browser.text_field(:id, find_label(field).for).set(value)
26
+ $browser.text_field(:id, find_label(field).for).set(value)
25
27
  end
26
28
 
27
29
  When /I check "(.*)"/ do |field|
28
- @browser.check_box(:id, find_label(field).for).set(true)
30
+ $browser.check_box(:id, find_label(field).for).set(true)
29
31
  end
30
32
 
31
33
  When /^I uncheck "(.*)"$/ do |field|
32
- @browser.check_box(:id, find_label(field).for).set(false)
34
+ $browser.check_box(:id, find_label(field).for).set(false)
33
35
  end
34
36
 
35
37
  When /I choose "(.*)"/ do |field|
36
- @browser.radio(:id, find_label(field).for).set(true)
38
+ $browser.radio(:id, find_label(field).for).set(true)
37
39
  end
38
40
 
39
41
  When /I go to "(.*)"/ do |path|
40
- @browser.goto @host + path
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
- @browser.page.getEnclosingWindow().getThreadManager().joinAll(10000)
47
+ $browser.page.getEnclosingWindow().getThreadManager().joinAll(10000)
46
48
  end
47
49
 
48
50
 
49
51
  Then /I should see "(.*)"/ do |text|
50
- @browser.html.should =~ /#{text}/m
52
+ $browser.html.should =~ /#{text}/m
51
53
  end
52
54
 
53
55
  Then /I should not see "(.*)"/ do |text|
54
- @browser.html.should_not =~ /#{text}/m
56
+ $browser.html.should_not =~ /#{text}/m
55
57
  end
56
58
 
57
59
  def find_label(text)
58
- @browser.label :text, text
60
+ $browser.label :text, text
59
61
  end
60
62
 
61
63
  def assert_successful_response
62
- status = @browser.page.web_response.status_code
64
+ status = $browser.page.web_response.status_code
63
65
  if(status == 302 || status == 301)
64
- location = @browser.page.web_response.get_response_header_value('Location')
66
+ location = $browser.page.web_response.get_response_header_value('Location')
65
67
  puts "Being redirected to #{location}"
66
- @browser.goto location
68
+ $browser.goto location
67
69
  elsif status != 200
68
- raise "Brower returned Response Code #{@browser.page.web_response.status_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, \"#{e.class}\", #{e.message.inspect}]\n"
20
+ _out << "[:exception, #{e.class.inspect}, #{e.message.inspect}, #{e.backtrace.inspect}]\n"
21
21
  end
22
22
  end
23
23
  end
@@ -22,7 +22,7 @@ module Culerity
22
22
  if res.first == :return
23
23
  res[1]
24
24
  elsif res.first == :exception
25
- raise "#{res[1]}: #{res[2]}"
25
+ raise res[1], res[2], res[3]
26
26
  end
27
27
  end
28
28
 
@@ -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("[:exception, \"RuntimeError\", \"test exception\"]\n")
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, \"RuntimeError\", \"test exception\"]", :<< => nil
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, 'RuntimeError: test exception')
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.2
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-02-15 00:00:00 -08:00
12
+ date: 2009-03-06 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency