wist 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -2
- data/lib/wist.rb +10 -35
- data/wist.gemspec +2 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d442dba7a20cc94dc952134c42fddae437ac2ef
|
4
|
+
data.tar.gz: e06f2b1593e82481e546b8b822a27ff13ae3f1ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89087afabf8ac0fb7523a910cbe45c5a97680caf4223a263df9a2b225414000a7fa449d27407696ca03be3903b4e33467b84b615482b74083fe657870ea42382
|
7
|
+
data.tar.gz: adb31d3a1ce95a42349abcc7f262127555d401ab8285adf215fd23433d6bfa7aec31dfe96e9fc38b251c816cac6bfeac4ac7d610a30701be0d92eded6816320e
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wist (0.4.
|
4
|
+
wist (0.4.1)
|
5
5
|
capybara
|
6
|
+
common_assert
|
6
7
|
selenium-webdriver
|
7
8
|
|
8
9
|
GEM
|
@@ -20,6 +21,7 @@ GEM
|
|
20
21
|
ffi (~> 1.0, >= 1.0.11)
|
21
22
|
cliver (0.3.2)
|
22
23
|
coderay (1.0.9)
|
24
|
+
common_assert (0.0.1)
|
23
25
|
ffi (1.9.10)
|
24
26
|
method_source (0.8.2)
|
25
27
|
mime-types (2.6.2)
|
@@ -48,7 +50,7 @@ GEM
|
|
48
50
|
rake (10.1.0)
|
49
51
|
ruby-progressbar (1.7.1)
|
50
52
|
rubyzip (1.1.7)
|
51
|
-
selenium-webdriver (2.
|
53
|
+
selenium-webdriver (2.48.1)
|
52
54
|
childprocess (~> 0.5)
|
53
55
|
multi_json (~> 1.0)
|
54
56
|
rubyzip (~> 1.0)
|
@@ -69,3 +71,6 @@ DEPENDENCIES
|
|
69
71
|
pry
|
70
72
|
rake
|
71
73
|
wist!
|
74
|
+
|
75
|
+
BUNDLED WITH
|
76
|
+
1.10.6
|
data/lib/wist.rb
CHANGED
@@ -2,15 +2,17 @@ module Wist
|
|
2
2
|
require 'selenium-webdriver'
|
3
3
|
require 'cgi'
|
4
4
|
require 'capybara'
|
5
|
+
require 'common_assert'
|
6
|
+
|
7
|
+
def self.included(klass)
|
8
|
+
klass.include CommonAssert
|
9
|
+
end
|
5
10
|
|
6
11
|
Capybara.register_driver :chrome do |app|
|
7
12
|
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
8
13
|
end
|
9
14
|
|
10
15
|
class << self
|
11
|
-
attr_accessor(:rspec_should)
|
12
|
-
attr_accessor(:rspec_expect)
|
13
|
-
attr_accessor(:assert_syntax_detected)
|
14
16
|
attr_accessor(:wait_time_method)
|
15
17
|
end
|
16
18
|
|
@@ -20,41 +22,14 @@ module Wist
|
|
20
22
|
:default_wait_time
|
21
23
|
end
|
22
24
|
|
23
|
-
|
24
25
|
module Helpers
|
25
26
|
module_function
|
26
27
|
|
27
|
-
def detect_assert_syntax
|
28
|
-
return if Wist.assert_syntax_detected
|
29
|
-
|
30
|
-
if defined?(RSpec)
|
31
|
-
if RSpec.configuration.expect_with[0].configuration.syntax.include?(:expect)
|
32
|
-
Wist.rspec_expect = true
|
33
|
-
else
|
34
|
-
Wist.rspec_should = true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
Wist.assert_syntax_detected = true
|
39
|
-
end
|
40
|
-
|
41
28
|
def blank?(obj)
|
42
29
|
obj.respond_to?(:empty?) ? obj.empty? : !obj
|
43
30
|
end
|
44
31
|
end
|
45
32
|
|
46
|
-
def wist_assert(value, expected)
|
47
|
-
Helpers.detect_assert_syntax
|
48
|
-
|
49
|
-
if Wist.rspec_expect
|
50
|
-
expect(value).to eq(expected)
|
51
|
-
elsif Wist.rspec_should
|
52
|
-
value.should == expected
|
53
|
-
else
|
54
|
-
assert_equal(expected, value)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
33
|
def wait_until(timeout: false)
|
59
34
|
do_instantly do
|
60
35
|
Selenium::WebDriver::Wait.new(timeout: timeout || @old_wait_time).until do
|
@@ -86,7 +61,7 @@ module Wist
|
|
86
61
|
def verify_tweet_button(text)
|
87
62
|
share_button_src = nil
|
88
63
|
wait_until { share_button_src = find('.twitter-share-button')[:src] }
|
89
|
-
|
64
|
+
common_assert_equal(CGI.parse(URI.parse(share_button_src.gsub('#', '?')).query)['text'][0], text)
|
90
65
|
end
|
91
66
|
|
92
67
|
def driver
|
@@ -196,11 +171,11 @@ module Wist
|
|
196
171
|
end
|
197
172
|
|
198
173
|
def assert_text(text, el_or_selector)
|
199
|
-
|
174
|
+
common_assert_equal(process_el_or_selector(el_or_selector).text, text)
|
200
175
|
end
|
201
176
|
|
202
177
|
def assert_text_include(text, el)
|
203
|
-
|
178
|
+
common_assert_equal(el.text.include?(text), true)
|
204
179
|
end
|
205
180
|
|
206
181
|
def parent(el)
|
@@ -217,7 +192,7 @@ module Wist
|
|
217
192
|
%w(has has_no).each do |prefix|
|
218
193
|
define_method("assert_#{prefix}_css") do |selector, opt = {}|
|
219
194
|
opt[:visible] = true if opt[:visible].nil?
|
220
|
-
|
195
|
+
common_assert_equal(send("#{prefix}_css?", selector, opt), true)
|
221
196
|
end
|
222
197
|
end
|
223
198
|
|
@@ -246,6 +221,6 @@ module Wist
|
|
246
221
|
end
|
247
222
|
|
248
223
|
def assert_el_has_link(selector, link)
|
249
|
-
|
224
|
+
common_assert_equal(get_js("$('#{selector}').attr('href')"), link)
|
250
225
|
end
|
251
226
|
end
|
data/wist.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'wist'
|
3
|
-
gem.version = '0.4.
|
3
|
+
gem.version = '0.4.1'
|
4
4
|
gem.summary = 'capybara helpers'
|
5
5
|
gem.author = 'Lihan Li'
|
6
6
|
gem.email = 'frankieteardrop@gmail.com'
|
@@ -9,6 +9,7 @@ Gem::Specification.new do |gem|
|
|
9
9
|
|
10
10
|
gem.add_dependency 'capybara'
|
11
11
|
gem.add_dependency 'selenium-webdriver'
|
12
|
+
gem.add_dependency 'common_assert'
|
12
13
|
|
13
14
|
gem.files = `git ls-files`.split("\n")
|
14
15
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lihan Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: common_assert
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description:
|
42
56
|
email: frankieteardrop@gmail.com
|
43
57
|
executables: []
|
@@ -80,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
94
|
version: '0'
|
81
95
|
requirements: []
|
82
96
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.4.5
|
97
|
+
rubygems_version: 2.4.5.1
|
84
98
|
signing_key:
|
85
99
|
specification_version: 4
|
86
100
|
summary: capybara helpers
|