wist 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4bf236ea011dd9f5516b6c63199ca7ef297408c
4
- data.tar.gz: 8d9410908f0b97f4a977be403059529a686a8616
3
+ metadata.gz: 92c7a729771ad5443f5138500cf840ee4e95d3e9
4
+ data.tar.gz: 64e03b847b5957264cf8c494d85506102f67ee51
5
5
  SHA512:
6
- metadata.gz: 0343ebdfc764ebc62de5cf1aacecefdf839c8ae39f2a4437358d164ca193e6bdccded05c26bafc4f8412b7798772ce5058f87eff188a90454f69f6264496108c
7
- data.tar.gz: 4ab8dfaa022e7f5803151a064d66b915aac1cbb2d328fe45f4ade721c3753a3812cbb31ae196d2f16f9ebec43f7d00b726ffa0ac143c3a61fa07be2a30bb1ff3
6
+ metadata.gz: 66ba3eaa0f21c10b9b191eda29e9894ef5a0f31731721146bfd06e63461957b7f8504004ef7e7dbabab730c91a9e541c8a63bc50c761e19e6eda2cb51e37b057
7
+ data.tar.gz: 9c9b800713baedad2fbe8924392fdff34514ff1dfe187e98b5e84abd8415295f4108c082ca4ca622366693757846c461fc73cc43314a08fce9c59778edffb75f
data/Gemfile CHANGED
@@ -2,8 +2,7 @@ source 'http://rubygems.org/'
2
2
  gemspec
3
3
 
4
4
  gem 'capybara', '2.2.1'
5
- gem 'tconsole', github: 'lihanli/tconsole'
6
5
  gem 'pry'
7
- gem 'turn'
8
6
  gem 'rake'
9
- gem "poltergeist", "1.5.0"
7
+ gem "poltergeist", "1.5.1"
8
+ gem 'minitest-reporters'
data/Gemfile.lock CHANGED
@@ -1,15 +1,7 @@
1
- GIT
2
- remote: git://github.com/lihanli/tconsole.git
3
- revision: fbc06123705a72d5b5c4509d7d471262cf68c170
4
- specs:
5
- tconsole (1.3.0.pre2)
6
- chattyproc (~> 1.0.0)
7
- term-ansicolor (~> 1.0.7)
8
-
9
1
  PATH
10
2
  remote: .
11
3
  specs:
12
- wist (0.2.3)
4
+ wist (0.2.4)
13
5
  capybara
14
6
  selenium-webdriver
15
7
 
@@ -17,25 +9,31 @@ GEM
17
9
  remote: http://rubygems.org/
18
10
  specs:
19
11
  ansi (1.4.3)
12
+ builder (3.2.2)
20
13
  capybara (2.2.1)
21
14
  mime-types (>= 1.16)
22
15
  nokogiri (>= 1.3.3)
23
16
  rack (>= 1.0.0)
24
17
  rack-test (>= 0.5.4)
25
18
  xpath (~> 2.0)
26
- chattyproc (1.0.0)
27
- childprocess (0.5.3)
19
+ childprocess (0.5.5)
28
20
  ffi (~> 1.0, >= 1.0.11)
29
21
  cliver (0.3.2)
30
22
  coderay (1.0.9)
31
- ffi (1.9.3)
23
+ ffi (1.9.6)
32
24
  method_source (0.8.2)
33
25
  mime-types (2.2)
34
26
  mini_portile (0.5.3)
27
+ minitest (5.4.3)
28
+ minitest-reporters (1.0.7)
29
+ ansi
30
+ builder
31
+ minitest (>= 5.0)
32
+ ruby-progressbar
35
33
  multi_json (1.9.2)
36
34
  nokogiri (1.6.1)
37
35
  mini_portile (~> 0.5.0)
38
- poltergeist (1.5.0)
36
+ poltergeist (1.5.1)
39
37
  capybara (~> 2.1)
40
38
  cliver (~> 0.3.1)
41
39
  multi_json (~> 1.0)
@@ -48,18 +46,16 @@ GEM
48
46
  rack-test (0.6.2)
49
47
  rack (>= 1.0)
50
48
  rake (10.1.0)
51
- rubyzip (1.1.4)
52
- selenium-webdriver (2.42.0)
53
- childprocess (>= 0.5.0)
49
+ ruby-progressbar (1.7.0)
50
+ rubyzip (1.1.6)
51
+ selenium-webdriver (2.43.0)
52
+ childprocess (~> 0.5)
54
53
  multi_json (~> 1.0)
55
54
  rubyzip (~> 1.0)
56
- websocket (~> 1.0.4)
55
+ websocket (~> 1.0)
57
56
  slop (3.4.6)
58
- term-ansicolor (1.0.7)
59
- turn (0.9.6)
60
- ansi
61
- websocket (1.0.7)
62
- websocket-driver (0.3.2)
57
+ websocket (1.2.1)
58
+ websocket-driver (0.4.0)
63
59
  xpath (2.0.0)
64
60
  nokogiri (~> 1.3)
65
61
 
@@ -68,9 +64,8 @@ PLATFORMS
68
64
 
69
65
  DEPENDENCIES
70
66
  capybara (= 2.2.1)
71
- poltergeist (= 1.5.0)
67
+ minitest-reporters
68
+ poltergeist (= 1.5.1)
72
69
  pry
73
70
  rake
74
- tconsole!
75
- turn
76
71
  wist!
data/lib/wist.rb CHANGED
@@ -7,6 +7,11 @@ module Wist
7
7
  Capybara::Selenium::Driver.new(app, browser: :chrome)
8
8
  end
9
9
 
10
+ class << self
11
+ attr_accessor(:rspec)
12
+ end
13
+ self.rspec = defined?(RSpec)
14
+
10
15
  module Helpers
11
16
  module_function
12
17
 
@@ -15,6 +20,14 @@ module Wist
15
20
  end
16
21
  end
17
22
 
23
+ def wist_assert(value, expected)
24
+ if Wist.rspec
25
+ value.should == expected
26
+ else
27
+ assert_equal(expected, value)
28
+ end
29
+ end
30
+
18
31
  def wait_until(timeout: false)
19
32
  do_instantly do
20
33
  Selenium::WebDriver::Wait.new(timeout: timeout || @old_wait_time).until do
@@ -46,7 +59,7 @@ module Wist
46
59
  def verify_tweet_button(text)
47
60
  share_button_src = nil
48
61
  wait_until { share_button_src = find('.twitter-share-button')[:src] }
49
- assert_equal text, CGI.parse(URI.parse(share_button_src.gsub('#', '?')).query)['text'][0]
62
+ wist_assert(CGI.parse(URI.parse(share_button_src.gsub('#', '?')).query)['text'][0], text)
50
63
  end
51
64
 
52
65
  def driver
@@ -64,7 +77,7 @@ module Wist
64
77
  def alert_accept(expected_msg = false)
65
78
  page.execute_script "window.alert = function(msg) { window.lastAlertMsg = msg; }"
66
79
  yield
67
- assert_equal(expected_msg, get_js('window.lastAlertMsg')) if expected_msg
80
+ wist_assert(get_js('window.lastAlertMsg'), expected_msg) if expected_msg
68
81
  end
69
82
 
70
83
  def get_js(code)
@@ -143,11 +156,11 @@ module Wist
143
156
  end
144
157
 
145
158
  def assert_text(text, el)
146
- assert_equal(text, el.text)
159
+ wist_assert(el.text, text)
147
160
  end
148
161
 
149
162
  def assert_text_include(text, el)
150
- assert_equal(true, el.text.include?(text))
163
+ wist_assert(el.text.include?(text), true)
151
164
  end
152
165
 
153
166
  def parent(el)
@@ -162,8 +175,9 @@ module Wist
162
175
  end
163
176
 
164
177
  %w(has has_no).each do |prefix|
165
- define_method("assert_#{prefix}_css") do |*args|
166
- assert_equal(true, send("#{prefix}_css?", *args))
178
+ define_method("assert_#{prefix}_css") do |selector, opt = {}|
179
+ opt[:visible] = true if opt[:visible].nil?
180
+ wist_assert(send("#{prefix}_css?", selector, opt), true)
167
181
  end
168
182
  end
169
183
 
data/test/test_helper.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'wist'
2
2
  require 'capybara/poltergeist'
3
3
  require 'pry'
4
- begin; require 'turn/autorun'; rescue LoadError; end
5
- Turn.config.format = :dot
4
+ require "minitest/autorun"
5
+ require "minitest/reporters"
6
+ Minitest::Reporters.use!
6
7
 
7
- class CapybaraTestCase < Test::Unit::TestCase
8
+ class CapybaraTestCase < Minitest::Test
8
9
  include Capybara::DSL
9
10
  include Wist
10
11
 
@@ -174,7 +174,7 @@ class WistTest < CapybaraTestCase
174
174
  end
175
175
 
176
176
  def test_assert_css
177
- assert_has_css('#click_test', visible: true)
177
+ assert_has_css('#click_test')
178
178
  assert_has_no_css('#dog123')
179
179
  end
180
180
 
data/wist.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'wist'
3
- gem.version = '0.2.3'
3
+ gem.version = '0.2.4'
4
4
  gem.summary = 'capybara helpers'
5
5
  gem.author = 'Lihan Li'
6
6
  gem.email = 'frankieteardrop@gmail.com'
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lihan Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description:
@@ -44,7 +44,7 @@ executables: []
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - .gitignore
47
+ - ".gitignore"
48
48
  - Gemfile
49
49
  - Gemfile.lock
50
50
  - MIT-LICENSE
@@ -70,17 +70,17 @@ require_paths:
70
70
  - lib
71
71
  required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
82
  rubyforge_project:
83
- rubygems_version: 2.0.14
83
+ rubygems_version: 2.2.2
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: capybara helpers