wist 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +5 -5
  3. data/lib/wist.rb +22 -3
  4. data/wist.gemspec +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c370b625a15f8f6afbdfb14fc5f30dc580bd27c
4
- data.tar.gz: dd781fd9a951314e8d8ad1f8bac9d1a7807a0648
3
+ metadata.gz: 3112671f26405f4c839b28cef0a2b6f7c6eb8f48
4
+ data.tar.gz: 8a8174b542d4fd09d73d28300af07dabd8ddd999
5
5
  SHA512:
6
- metadata.gz: abfe05c4100a3dea36b3fe706ae7aa93ec2895ad276f9a9273fb0cbbed15829265070d91fc3db5de7ad9fb6101d93a54439978a80c64c376eb9c77f1acfe6365
7
- data.tar.gz: 41100526e16041085290d7f20bd865ea0e8bbbf777ccec7f03f923c8ca5031921ef4a4fc8914bc22e66b61b242c7772a70dbbc95a4363d12a0b595c4abeb7780
6
+ metadata.gz: cc2f1d98dea77c4025989044ba114b19d96deeda8134c130877e012497f2d0a5f3f6f864fdccba937edb13ee5eaaf434939872b8a426e8b4f18f7b7cd0fe0d58
7
+ data.tar.gz: f6003c1fd3892a3e8e0854ab1be25ac1872b70d3adbb4407cbff7d51f30a1125d2ce3c4d577308c07ce49f5b3ba0d14442c9582f72b5c3d58d70f67a07afacbb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wist (0.2.7)
4
+ wist (0.3.0)
5
5
  capybara
6
6
  selenium-webdriver
7
7
 
@@ -16,11 +16,11 @@ GEM
16
16
  rack (>= 1.0.0)
17
17
  rack-test (>= 0.5.4)
18
18
  xpath (~> 2.0)
19
- childprocess (0.5.5)
19
+ childprocess (0.5.6)
20
20
  ffi (~> 1.0, >= 1.0.11)
21
21
  cliver (0.3.2)
22
22
  coderay (1.0.9)
23
- ffi (1.9.8)
23
+ ffi (1.9.10)
24
24
  method_source (0.8.2)
25
25
  mime-types (2.4.3)
26
26
  mini_portile (0.6.2)
@@ -48,13 +48,13 @@ GEM
48
48
  rake (10.1.0)
49
49
  ruby-progressbar (1.7.1)
50
50
  rubyzip (1.1.7)
51
- selenium-webdriver (2.45.0)
51
+ selenium-webdriver (2.46.2)
52
52
  childprocess (~> 0.5)
53
53
  multi_json (~> 1.0)
54
54
  rubyzip (~> 1.0)
55
55
  websocket (~> 1.0)
56
56
  slop (3.4.6)
57
- websocket (1.2.1)
57
+ websocket (1.2.2)
58
58
  websocket-driver (0.4.0)
59
59
  xpath (2.0.0)
60
60
  nokogiri (~> 1.3)
data/lib/wist.rb CHANGED
@@ -8,20 +8,39 @@ module Wist
8
8
  end
9
9
 
10
10
  class << self
11
- attr_accessor(:rspec)
11
+ attr_accessor(:rspec_should)
12
+ attr_accessor(:rspec_expect)
13
+ attr_accessor(:assert_syntax_detected)
12
14
  end
13
- self.rspec = defined?(RSpec)
14
15
 
15
16
  module Helpers
16
17
  module_function
17
18
 
19
+ def detect_assert_syntax
20
+ return if Wist.assert_syntax_detected
21
+
22
+ if defined?(RSpec)
23
+ if RSpec.configuration.expect_with[0].configuration.syntax.include?(:expect)
24
+ Wist.rspec_expect = true
25
+ else
26
+ Wist.rspec_should = true
27
+ end
28
+ end
29
+
30
+ Wist.assert_syntax_detected = true
31
+ end
32
+
18
33
  def blank?(obj)
19
34
  obj.respond_to?(:empty?) ? obj.empty? : !obj
20
35
  end
21
36
  end
22
37
 
23
38
  def wist_assert(value, expected)
24
- if Wist.rspec
39
+ Helpers.detect_assert_syntax
40
+
41
+ if Wist.rspec_expect
42
+ expect(value).to eq(expected)
43
+ elsif Wist.rspec_should
25
44
  value.should == expected
26
45
  else
27
46
  assert_equal(expected, value)
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.7'
3
+ gem.version = '0.3.0'
4
4
  gem.summary = 'capybara helpers'
5
5
  gem.author = 'Lihan Li'
6
6
  gem.email = 'frankieteardrop@gmail.com'
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.2.7
4
+ version: 0.3.0
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-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara