marty_rspec 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/README.md +36 -23
- data/lib/marty_rspec/util.rb +6 -6
- data/lib/marty_rspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e6f32cb8c201cb275db2a99e3fddf1f3fd8768
|
4
|
+
data.tar.gz: 802aa7254ba7fc4a416a2a99010780c159abe9e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a15529ce94d26f12e6abd9581f5a98cdf1bee20388f942a2b1b4beef6bd93dc4763f205bd02ac616a6a1254969956f7734c40559583890869e4f4c0b54d80f79
|
7
|
+
data.tar.gz: 805ea18225e011919703c62b7e5385c6f2ca80ea24e3ffe8b38f37a56a5b938fe813c06437f4c834659fa45d61327a2b1aba360b98409edd996afef61726f585
|
data/README.md
CHANGED
@@ -1,51 +1,52 @@
|
|
1
1
|
# Marty RSpec
|
2
2
|
|
3
|
-
is a set of helper methods for integration/feature testing for the [Marty](https://github.com/arman000/marty) framework. In particular, it primarily maps javascript functions to provide Capybara-like behavior for Netzke/ExtJS components.
|
3
|
+
is a set of helper methods for integration/feature testing for the [Marty](https://github.com/arman000/marty) framework. In particular, it primarily maps javascript functions to provide Capybara-like behavior for Netzke/ExtJS components.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
7
|
-
On the macro-level, Marty RSpec functionality can be broken up into 6 pieces.
|
7
|
+
On the macro-level, Marty RSpec functionality can be broken up into 6 pieces.
|
8
8
|
|
9
9
|
1. General Utility functions
|
10
10
|
|
11
|
-
examples include log_in, press(button)
|
11
|
+
examples include log_in, press(button)
|
12
12
|
|
13
13
|
2. Wait functions
|
14
14
|
|
15
|
-
because netzke/extjs requires execute_scripts all over the place, and because this causes intermittent timing failures
|
15
|
+
because netzke/extjs requires execute_scripts all over the place, and because this causes intermittent timing failures
|
16
16
|
|
17
17
|
3. Netzke Component Utility functions
|
18
|
-
|
19
|
-
first, call `c = netzke_find(name, component_type)`
|
20
|
-
note that this doesn't actually 'find' the component a la Capybara. Instead, it prepares the javascript to be used for the particular component helper method. So, in order for any javascript to run, you would need to call (on a grid), for example, `c.row_count`
|
21
18
|
|
22
|
-
|
19
|
+
first, call `c = netzke_find(name, component_type)`
|
23
20
|
|
24
|
-
this
|
21
|
+
note that this doesn't actually 'find' the component a la Capybara. Instead, it prepares the javascript to be used for the particular component helper method. So, in order for any javascript to run, you would need to call (on a grid), for example, `c.row_count`
|
22
|
+
|
23
|
+
1. component_type = 'gridpanel'
|
24
|
+
|
25
|
+
this is the default
|
25
26
|
|
26
27
|
2. component_type = 'combobox'
|
27
28
|
|
28
29
|
4. Custom Capybara selectors
|
29
30
|
|
30
|
-
for using Capybara find on commonly used netzke/extjs DOM items
|
31
|
+
for using Capybara find on commonly used netzke/extjs DOM items
|
31
32
|
|
32
33
|
5. Custom RSpec Matchers
|
33
34
|
|
34
|
-
6. RSpec-by formatter
|
35
|
+
6. RSpec-by formatter
|
35
36
|
|
36
|
-
|
37
|
+
this is actually an external gem that provides verbose RSpec formatter with benchmarking capabilities. You can wrap bits of longer feature tests in a block. RSpec will print the messages out with how many seconds each block took to complete.
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
```ruby
|
40
|
+
# the beginning of your awesome test
|
41
|
+
by 'your output message here' do
|
42
|
+
# some test stuff here
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
and_by 'your next step' do
|
46
|
+
# some other test stuff here
|
47
|
+
end
|
48
|
+
# the rest of your awesome test
|
49
|
+
```
|
49
50
|
|
50
51
|
## Installation
|
51
52
|
|
@@ -63,6 +64,19 @@ Or install it yourself as:
|
|
63
64
|
|
64
65
|
$ gem install marty_rspec
|
65
66
|
|
67
|
+
Add the following to your spec_helper.rb (you may want to scope to js tests only):
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
require 'marty_rspec'
|
71
|
+
|
72
|
+
# ...
|
73
|
+
|
74
|
+
RSpec.configure do |config|
|
75
|
+
config.include MartyRSpec::Util #, js:true
|
76
|
+
# ...
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
66
80
|
## Contributing
|
67
81
|
|
68
82
|
Bug reports and pull requests are welcome on GitHub at https://github.com/sleepn247/marty_rspec.
|
@@ -71,4 +85,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/sleepn
|
|
71
85
|
## License
|
72
86
|
|
73
87
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
74
|
-
|
data/lib/marty_rspec/util.rb
CHANGED
@@ -149,20 +149,20 @@ module MartyRSpec
|
|
149
149
|
end
|
150
150
|
|
151
151
|
private
|
152
|
-
def simple_escape
|
153
|
-
text.gsub
|
154
|
-
|
155
|
-
|
152
|
+
def simple_escape text
|
153
|
+
text.gsub(/(\r\n|\n)/, "\\n")
|
154
|
+
.gsub(/\t/, "\\t")
|
155
|
+
.gsub(/"/, '\"')
|
156
156
|
end
|
157
157
|
|
158
158
|
def paste text, textarea
|
159
159
|
# bit hacky: textarea doesn't like receiving tabs and newlines via fill_in
|
160
|
-
simple_escape
|
160
|
+
escaped = simple_escape(text)
|
161
161
|
|
162
162
|
find(:xpath, ".//textarea[@name='#{textarea}']")
|
163
163
|
run_js <<-JS
|
164
164
|
#{ext_var(ext_find(ext_arg('textarea', name: textarea)), 'area')}
|
165
|
-
area.setValue("#{
|
165
|
+
area.setValue("#{escaped}");
|
166
166
|
return true;
|
167
167
|
JS
|
168
168
|
end
|
data/lib/marty_rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marty_rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaki Matsuo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|