capy 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +6 -0
  2. data/lib/capy.rb +19 -1
  3. data/lib/capy/version.rb +1 -1
  4. metadata +62 -97
data/README.md CHANGED
@@ -39,6 +39,12 @@ and capy with '-w' option
39
39
 
40
40
  $ capy -w example.capy
41
41
 
42
+ ### To access the elements within iframe
43
+
44
+ iframe('IFRAME_ID') do
45
+ click_on 'link'
46
+ end
47
+
42
48
  ### JavaScript Mode
43
49
 
44
50
  # example.js
data/lib/capy.rb CHANGED
@@ -103,7 +103,7 @@ module Capy
103
103
  begin
104
104
  result = evaluater.eval_script(buf, mode)
105
105
  puts "=> #{result.inspect}".cyan
106
- rescue => e
106
+ rescue Exception => e
107
107
  error e
108
108
  end
109
109
  end
@@ -150,6 +150,24 @@ module Capy
150
150
  instance_eval script
151
151
  end
152
152
 
153
+ def iframe(id)
154
+ raise 'no block given' unless block_given?
155
+ browser.switch_to.frame(id)
156
+ begin
157
+ yield
158
+ ensure
159
+ browser.switch_to.default_content
160
+ end
161
+ end
162
+
163
+ def driver
164
+ page.driver
165
+ end
166
+
167
+ def browser
168
+ driver.browser
169
+ end
170
+
153
171
  def host(app_host)
154
172
  Capybara.app_host = app_host
155
173
  end
data/lib/capy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Capy
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.1"
3
3
  end
metadata CHANGED
@@ -1,104 +1,79 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capy
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 4
9
- - 0
10
- version: 1.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.1
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - jugyo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-24 00:00:00 +09:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-04-25 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: slop
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70334156038120 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 5
30
- segments:
31
- - 3
32
- - 1
33
- version: "3.1"
20
+ - !ruby/object:Gem::Version
21
+ version: '3.1'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: capybara
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70334156038120
25
+ - !ruby/object:Gem::Dependency
26
+ name: capybara
27
+ requirement: &70334156037580 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
48
33
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: colored
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70334156037580
36
+ - !ruby/object:Gem::Dependency
37
+ name: colored
38
+ requirement: &70334156036960 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
62
44
  type: :runtime
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: rspec
66
45
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70334156036960
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70334156036200 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
76
55
  type: :development
77
- version_requirements: *id004
78
- - !ruby/object:Gem::Dependency
79
- name: rr
80
56
  prerelease: false
81
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70334156036200
58
+ - !ruby/object:Gem::Dependency
59
+ name: rr
60
+ requirement: &70334156035780 !ruby/object:Gem::Requirement
82
61
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
90
66
  type: :development
91
- version_requirements: *id005
67
+ prerelease: false
68
+ version_requirements: *70334156035780
92
69
  description: Capybara Script Runner
93
- email:
70
+ email:
94
71
  - jugyo.org@gmail.com
95
- executables:
72
+ executables:
96
73
  - capy
97
74
  extensions: []
98
-
99
75
  extra_rdoc_files: []
100
-
101
- files:
76
+ files:
102
77
  - .gitignore
103
78
  - Gemfile
104
79
  - LICENSE
@@ -115,41 +90,31 @@ files:
115
90
  - spec/fixtures/foo.capy
116
91
  - spec/fixtures/foo.js
117
92
  - spec/spec_helper.rb
118
- has_rdoc: true
119
93
  homepage: https://github.com/jugyo
120
94
  licenses: []
121
-
122
95
  post_install_message:
123
96
  rdoc_options: []
124
-
125
- require_paths:
97
+ require_paths:
126
98
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
128
100
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
106
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
145
111
  requirements: []
146
-
147
112
  rubyforge_project:
148
- rubygems_version: 1.3.7
113
+ rubygems_version: 1.8.10
149
114
  signing_key:
150
115
  specification_version: 3
151
116
  summary: The capy command to run the script written in Capybara DSL.
152
- test_files:
117
+ test_files:
153
118
  - spec/capy_spec.rb
154
119
  - spec/fixtures/foo.capy
155
120
  - spec/fixtures/foo.js