weinre-rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +35 -3
- data/lib/assets/javascripts/weinre-rails.js +11 -4
- data/lib/weinre-rails.rb +9 -4
- data/lib/weinre/rails/cucumber.rb +8 -0
- data/lib/weinre/rails/engine.rb +7 -0
- data/lib/{weinre-rails → weinre/rails}/version.rb +1 -1
- data/weinre-rails.gemspec +1 -1
- metadata +22 -43
- data/lib/weinre-rails/cucumber.rb +0 -7
- data/lib/weinre-rails/engine.rb +0 -6
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# Weinre::Rails
|
2
2
|
|
3
|
-
|
3
|
+
Some helpers for integrating the awesome Weinre app with a Rails 3.1+ set up. It wouldn't take took much to use it with Rails < 3.1 as long as you're ok with getting the asset pipeline bolted in. It's assumed that if you're using this for testing with Cucumber that you'll be using something like Capybara so that you have a Javascript engine.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
|
9
|
+
group :cucumber, :development, :test do
|
10
|
+
gem 'weinre-rails'
|
11
|
+
end
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
@@ -18,7 +20,37 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
This is a very simple wrapper done as a Rails Engine which gives us Asset Pipeline goodness. To use it just put a
|
24
|
+
|
25
|
+
//= require weinre-rails
|
26
|
+
|
27
|
+
Into your `application.js` and you'll be off to the races. Whenever you want to connect to a Weinre server just execute:
|
28
|
+
|
29
|
+
$.connectWeinre()
|
30
|
+
|
31
|
+
from your javascript and you're good to go.
|
32
|
+
|
33
|
+
There's a handy cucumber step that lets you pause a scenario and inspect the current state of the test in Weinre. To do this include `weinre-rails/cucumber` in `env.rb` like so:
|
34
|
+
|
35
|
+
require 'weinre/rails/cucumber'
|
36
|
+
|
37
|
+
And in your scenario do something like:
|
38
|
+
|
39
|
+
Scenario: I'm testing something complicated
|
40
|
+
Given I am doing something complicated with javascript
|
41
|
+
When some weird condition occurs
|
42
|
+
Then I start remote debugging
|
43
|
+
Execution paused by weinre-rails, press enter when ready
|
44
|
+
|
45
|
+
The app will pause until you hit *enter* in the console at which point it will keep going.
|
46
|
+
|
47
|
+
By default the cucumber test will try to connect to:
|
48
|
+
|
49
|
+
http://localhost:8080/target/target-script-min.js#anonymous
|
50
|
+
|
51
|
+
If you want to change that you can:
|
52
|
+
|
53
|
+
Weinre::Rails.url = "http://localhost:9090/target/target-script-min.js#anonymous"
|
22
54
|
|
23
55
|
## Contributing
|
24
56
|
|
@@ -3,10 +3,17 @@
|
|
3
3
|
if(options == undefined) {
|
4
4
|
options = {};
|
5
5
|
}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
|
7
|
+
if(options.url === undefined) {
|
8
|
+
var host = options.host || "127.0.0.1";
|
9
|
+
var port = options.port || "8080";
|
10
|
+
var id = options.id || "anonymous";
|
11
|
+
var path = options.path || "/target/target-script-min.js#";
|
12
|
+
|
13
|
+
var url = "http://" + host + ":" + port + path + id;
|
14
|
+
} else {
|
15
|
+
var url = options.url;
|
16
|
+
}
|
10
17
|
|
11
18
|
var script = document.createElement( 'script' );
|
12
19
|
script.type = 'text/javascript';
|
data/lib/weinre-rails.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
require "weinre-rails/version"
|
2
|
-
|
3
1
|
module Weinre
|
4
|
-
module Rails
|
2
|
+
module Rails
|
3
|
+
include ActiveSupport::Configurable
|
4
|
+
|
5
|
+
config_accessor :url
|
6
|
+
self.url = "http://localhost:8080/target/target-script-min.js#anonymous"
|
7
|
+
|
8
|
+
autoload :Engine, "weinre/rails/engine"
|
5
9
|
|
10
|
+
autoload :VERSION, "weinre/rails/version"
|
6
11
|
end
|
7
12
|
end
|
8
13
|
|
9
|
-
require "weinre
|
14
|
+
require "weinre/rails/engine" if defined?(Rails)
|
data/weinre-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,33 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: weinre-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Andrew Eberbach
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-04-10 00:00:00 Z
|
12
|
+
date: 2012-07-08 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: A Rails 3 helper for Weinre
|
22
|
-
email:
|
15
|
+
email:
|
23
16
|
- andrew@ebertech.ca
|
24
17
|
executables: []
|
25
|
-
|
26
18
|
extensions: []
|
27
|
-
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- .gitignore
|
32
22
|
- Gemfile
|
33
23
|
- LICENSE
|
@@ -35,43 +25,32 @@ files:
|
|
35
25
|
- Rakefile
|
36
26
|
- lib/assets/javascripts/weinre-rails.js
|
37
27
|
- lib/weinre-rails.rb
|
38
|
-
- lib/weinre
|
39
|
-
- lib/weinre
|
40
|
-
- lib/weinre
|
28
|
+
- lib/weinre/rails/cucumber.rb
|
29
|
+
- lib/weinre/rails/engine.rb
|
30
|
+
- lib/weinre/rails/version.rb
|
41
31
|
- weinre-rails.gemspec
|
42
32
|
homepage:
|
43
33
|
licenses: []
|
44
|
-
|
45
34
|
post_install_message:
|
46
35
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
36
|
+
require_paths:
|
49
37
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
39
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
- 0
|
58
|
-
version: "0"
|
59
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
45
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
version: "0"
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
68
50
|
requirements: []
|
69
|
-
|
70
51
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
52
|
+
rubygems_version: 1.8.24
|
72
53
|
signing_key:
|
73
54
|
specification_version: 3
|
74
55
|
summary: Provides asset-pipeline javascript for connecting to weinre
|
75
56
|
test_files: []
|
76
|
-
|
77
|
-
has_rdoc:
|
@@ -1,7 +0,0 @@
|
|
1
|
-
Then /^I start remote debugging$/ do
|
2
|
-
url = "http://localhost:8080/target/target-script-min.js#anonymous"
|
3
|
-
script = %Q{jQuery("body").append("<script src='#{url}'></script>")}
|
4
|
-
page.execute_script(script)
|
5
|
-
puts "Executing paused, press enter when ready"
|
6
|
-
$stdin.gets
|
7
|
-
end
|