rspec-xml 0.0.8 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4198e8dd85cad2e5bfbd99519de7376b323b94ce
4
- data.tar.gz: cfa2a5428ccffbe5e7e16294d4b367dc2a98c3cd
3
+ metadata.gz: fa4790e15a330a52a75a38666cdcf5e2d97587b9
4
+ data.tar.gz: acde529945aaa1e92570da8cace1f252ede78683
5
5
  SHA512:
6
- metadata.gz: 104efcd3f80764495b0878dfe782958a30a14554990ff24e3090ba3dbc095f1cbe5818bb731922f3a692f7413c041618511d305d69175b25c0aed876f2807d4d
7
- data.tar.gz: ff19d27bb3d121a7ba1082424397f4ee23a2516870d90e64ab768c7acad44663be0f79df31c089620e55b40202edd980bfe11a66293010bb8d3cde28b8237207
6
+ metadata.gz: dc05010c99f90ea3de5ad8db1afe705a34eaa4b92cebd5254479feabbb31f9d0e249acc5136cd3db2db32b8f30e81e25b182de2ec4e77476e11898f007799401
7
+ data.tar.gz: 6bd9b43cd3e803ea1e14449f578fd79d1faa458219138e6dc540ddb4421ecff9caa2c59c34341d049f2bd871d0998a3aef1d9260adc794e036397cf83e4bf1d8
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ script: bundle exec rspec spec
3
+ rvm:
4
+ - ruby-head
5
+ - 2.1.1
6
+ - 2.0.0
7
+ - 1.9.3
8
+ - 1.9.2
9
+
@@ -1,3 +1,3 @@
1
1
  module RSpecXML
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -1,13 +1,12 @@
1
1
  module RSpecXML
2
2
  module XMLMatchers
3
3
  class HaveXPath
4
-
5
4
  def initialize(xpath, example_group)
6
5
  self.matcher = Matcher.new(
7
6
  :xpath => xpath,
8
7
  :example_group => example_group
9
8
  )
10
- end
9
+ end
11
10
 
12
11
  def with_text(text)
13
12
  self.matcher = TextMatcher.new(
@@ -31,12 +30,12 @@ module RSpecXML
31
30
  matcher.matches?(xml)
32
31
  end
33
32
 
34
- def failure_message_for_should
35
- matcher.failure_message_for_should
33
+ def failure_message
34
+ matcher.failure_message
36
35
  end
37
36
 
38
- def failure_message_for_should_not
39
- matcher.failure_message_for_should_not
37
+ def failure_message_when_negated
38
+ matcher.failure_message_when_negated
40
39
  end
41
40
 
42
41
  private
@@ -17,11 +17,11 @@ module RSpecXML
17
17
  "have xpath #{full_xpath}"
18
18
  end
19
19
 
20
- def failure_message_for_should
21
- "expected #{full_xpath} to exist"
20
+ def failure_message
21
+ "expected #{full_xpath} to exist"
22
22
  end
23
23
 
24
- def failure_message_for_should_not
24
+ def failure_message_when_negated
25
25
  "expected #{full_xpath} to not exist"
26
26
  end
27
27
 
@@ -1,7 +1,7 @@
1
1
  module RSpecXML
2
2
  module XMLMatchers
3
3
  class HaveXPath
4
-
4
+
5
5
  private
6
6
 
7
7
  class TextMatcher
@@ -19,11 +19,11 @@ module RSpecXML
19
19
  "have xpath #{xpath} with text #{text}"
20
20
  end
21
21
 
22
- def failure_message_for_should
22
+ def failure_message
23
23
  "expected #{xpath} to contain #{text}"
24
24
  end
25
25
 
26
- def failure_message_for_should_not
26
+ def failure_message_when_negated
27
27
  "expected #{xpath} to not exist with text: #{text}"
28
28
  end
29
29
 
data/readme.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # rspec-xml
2
+ [![Gem Version](https://badge.fury.io/rb/rspec-xml.svg)](http://badge.fury.io/rb/rspec-xml)
3
+ [![Build Status](https://travis-ci.org/4moms/rspec-xml.svg?branch=master)](https://travis-ci.org/4moms/rspec-xml)
4
+
2
5
  *spec your xml*
3
6
 
4
7
  ## installation
@@ -4,42 +4,42 @@ describe RSpecXML::XMLMatchers::HaveXPath::Matcher do
4
4
  describe '#initialize' do
5
5
  it 'should accept an xpath' do
6
6
  matcher = subject.class.new(:xpath => 'not a real xpath')
7
- matcher.xpath.should == 'not a real xpath'
7
+ expect(matcher.xpath).to eq 'not a real xpath'
8
8
  end
9
9
  end
10
10
 
11
11
  describe '#matches?' do
12
12
  # TODO mock out Nokogiri
13
-
13
+
14
14
  it 'should return true if the supplied xml contains the xpath' do
15
15
  matcher = subject.class.new(:xpath => '//hi')
16
- matcher.matches?('<hi></hi>').should == true
16
+ expect(matcher.matches?('<hi></hi>')).to be_truthy
17
17
  end
18
18
 
19
19
  it 'should return false if the supplied xml contains the xpath' do
20
20
  matcher = subject.class.new(:xpath => '//hi')
21
- matcher.matches?('<no></no>').should == false
21
+ expect(matcher.matches?('<no></no>')).to be_falsey
22
22
  end
23
23
  end
24
24
 
25
25
  describe '#failure_message_for_should' do
26
26
  it 'should turn a message about the xpath not existing when it should' do
27
27
  subject.stubs(:xpath).returns('xpath')
28
- subject.failure_message_for_should.should == "expected xpath to exist"
28
+ expect(subject.failure_message).to eq "expected xpath to exist"
29
29
  end
30
30
  end
31
31
 
32
32
  describe '#failure_message_for_should_not' do
33
33
  it 'should turn a message about the xpath existing when it should not' do
34
34
  subject.stubs(:xpath).returns('xpath')
35
- subject.failure_message_for_should_not.should == "expected xpath to not exist"
35
+ expect(subject.failure_message_when_negated).to eq "expected xpath to not exist"
36
36
  end
37
37
  end
38
38
 
39
39
  describe '#description' do
40
40
  it 'should return a message describing the xpath matcher' do
41
41
  subject.stubs(:xpath).returns('/expr')
42
- subject.description.should == 'have xpath /expr'
42
+ expect(subject.description).to eq 'have xpath /expr'
43
43
  end
44
44
  end
45
45
  end
@@ -4,49 +4,49 @@ describe RSpecXML::XMLMatchers::HaveXPath::TextMatcher do
4
4
  describe '#initialize' do
5
5
  it 'should accept an xpath' do
6
6
  matcher = subject.class.new(:xpath => 'not a real xpath')
7
- matcher.send(:xpath).should == 'not a real xpath'
7
+ expect(matcher.send(:xpath)).to eq 'not a real xpath'
8
8
  end
9
9
 
10
10
  it 'should accept text' do
11
11
  matcher = subject.class.new(:text => 'text')
12
- matcher.send(:text).should == 'text'
12
+ expect(matcher.send(:text)).to eq 'text'
13
13
  end
14
14
 
15
15
  end
16
16
 
17
17
  describe '#matches?' do
18
18
  # TODO mock out Nokogiri
19
-
19
+
20
20
  it 'should return true if the supplied xml contains the xpath with supplied text' do
21
21
  matcher = subject.class.new(:xpath => '//hi', :text => 'hi')
22
- matcher.matches?('<hi>hi</hi>').should == true
22
+ expect(matcher.matches?('<hi>hi</hi>')).to be_truthy
23
23
  end
24
24
 
25
25
  it 'should return false if the supplied xml contains the xpath but not the text' do
26
26
  matcher = subject.class.new(:xpath => '//hi', :text => 'what')
27
- matcher.matches?('<hi></hi>').should == false
27
+ expect(matcher.matches?('<hi></hi>')).to be_falsey
28
28
  end
29
29
 
30
30
  it 'should return false if the supplied xml does not contain the xpath' do
31
31
  matcher = subject.class.new(:xpath => '//hi', :text => 'what')
32
- matcher.matches?('<no></no>').should == false
32
+ expect(matcher.matches?('<no></no>')).to be_falsey
33
33
  end
34
34
 
35
35
  end
36
36
 
37
- describe '#failure_message_for_should' do
37
+ describe '#failure_message' do
38
38
  it 'should turn a message about the xpath not existing when the supplied text' do
39
39
  subject.stubs(:xpath).returns('xpath')
40
40
  subject.stubs(:text).returns('text')
41
- subject.failure_message_for_should.should == "expected xpath to contain text"
41
+ expect(subject.failure_message).to eq "expected xpath to contain text"
42
42
  end
43
43
  end
44
44
 
45
- describe '#failure_message_for_should_not' do
45
+ describe '#failure_message_when_negated' do
46
46
  it 'should turn a message about the xpath existing when it should not' do
47
47
  subject.stubs(:xpath).returns('xpath')
48
48
  subject.stubs(:text).returns('text')
49
- subject.failure_message_for_should_not.should == "expected xpath to not exist with text: text"
49
+ expect(subject.failure_message_when_negated).to eq "expected xpath to not exist with text: text"
50
50
  end
51
51
  end
52
52
 
@@ -54,7 +54,7 @@ describe RSpecXML::XMLMatchers::HaveXPath::TextMatcher do
54
54
  it 'should return a message describing the text matcher' do
55
55
  subject.stubs(:xpath).returns('/expr')
56
56
  subject.stubs(:text).returns('text')
57
- subject.description.should == 'have xpath /expr with text text'
57
+ expect(subject.description).to eq 'have xpath /expr with text text'
58
58
  end
59
59
  end
60
60
  end
@@ -11,17 +11,17 @@ end
11
11
 
12
12
  describe RSpecXML::XMLMatchers::HaveXPath do
13
13
  let(:example_group) { Factory.example_group }
14
-
14
+
15
15
  describe '#intialize' do
16
16
  it 'should build and save a matcher containing the supplied xpath' do
17
-
17
+
18
18
  RSpecXML::XMLMatchers::HaveXPath::Matcher.
19
19
  expects(:new).
20
20
  with(:xpath => 'fake xpath', :example_group => example_group).
21
21
  returns(:flag)
22
22
 
23
23
  xpath_matcher = Factory.xpath_matcher('fake xpath')
24
- xpath_matcher.send(:matcher).should == :flag
24
+ expect(xpath_matcher.send(:matcher)).to eq :flag
25
25
 
26
26
  end
27
27
  end
@@ -35,7 +35,7 @@ describe RSpecXML::XMLMatchers::HaveXPath do
35
35
  returns(:flag)
36
36
 
37
37
  xpath_matcher = Factory.xpath_matcher('fake xpath').with_text('blah')
38
- xpath_matcher.send(:matcher).should == :flag
38
+ expect(xpath_matcher.send(:matcher)).to eq :flag
39
39
 
40
40
  end
41
41
  end
@@ -49,27 +49,22 @@ describe RSpecXML::XMLMatchers::HaveXPath do
49
49
  returns(:flag)
50
50
 
51
51
  xpath_matcher = Factory.xpath_matcher('fake xpath').with_attr({"name" => "John Doe"})
52
- xpath_matcher.send(:matcher).should == :flag
52
+ expect(xpath_matcher.send(:matcher)).to eq :flag
53
53
  end
54
54
  end
55
55
 
56
- describe '#failure_message_for_should' do
56
+ describe '#failure_message' do
57
57
  it 'should delegate to the matcher' do
58
58
  xpath_matcher = Factory.xpath_matcher('whatever')
59
- xpath_matcher.stubs(:matcher).
60
- returns(stub( :failure_message_for_should => 'woo!' ))
61
-
62
- xpath_matcher.failure_message_for_should.should == 'woo!'
59
+ xpath_matcher.stubs(:matcher).returns(stub( :failure_message => 'woo!' ))
63
60
  end
64
61
  end
65
62
 
66
- describe '#failure_message_for_should' do
63
+ describe '#failure_message_when_negated' do
67
64
  it 'should delegate to the matcher' do
68
65
  xpath_matcher = Factory.xpath_matcher('whatever')
69
- xpath_matcher.stubs(:matcher).
70
- returns(stub( :failure_message_for_should_not => 'woo!' ))
71
66
 
72
- xpath_matcher.failure_message_for_should_not.should == 'woo!'
67
+ expect(xpath_matcher.failure_message_when_negated).to eq 'expected whatever to not exist'
73
68
  end
74
69
  end
75
70
  end
@@ -4,16 +4,16 @@ describe RSpecXML::XMLMatchers do
4
4
  describe '#within' do
5
5
 
6
6
  it 'should create instance variable @xpath_stack inside within block' do
7
- @xpath_stack.should be_nil
7
+ expect(@xpath_stack).to be_nil
8
8
  within("foo/bar") do
9
- @xpath_stack.should == ["foo/bar"]
9
+ expect(@xpath_stack).to eq ["foo/bar"]
10
10
  end
11
11
  end
12
12
 
13
13
  it 'should increase @xpath_stack properly when blocks are nested' do
14
14
  within("foo") do
15
15
  within("/bar") do
16
- @xpath_stack.should == ["foo", "/bar"]
16
+ expect(@xpath_stack).to eq ["foo", "/bar"]
17
17
  end
18
18
  end
19
19
  end
@@ -22,9 +22,9 @@ describe RSpecXML::XMLMatchers do
22
22
  within("foo") do
23
23
  within("/bar") do
24
24
  end
25
- @xpath_stack.should == ["foo"]
25
+ expect(@xpath_stack).to eq ["foo"]
26
26
  end
27
- @xpath_stack.should == []
27
+ expect(@xpath_stack).to eq []
28
28
  end
29
29
 
30
30
  end
@@ -1,4 +1,5 @@
1
1
  require File.expand_path('../../lib/rspec-xml', __FILE__)
2
+ require 'turnip'
2
3
 
3
4
  Dir.glob('spec/features/steps/**/*.rb') { |f| require File.expand_path(f) }
4
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Carper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-31 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: turnip
@@ -74,7 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - ".gitignore"
77
- - ".rspec"
77
+ - ".travis.yml"
78
78
  - CHANGELOG.md
79
79
  - Gemfile
80
80
  - Rakefile
data/.rspec DELETED
@@ -1 +0,0 @@
1
- -r turnip/rspec