fakeweb-matcher 1.2.3 → 1.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
- SHA1:
3
- metadata.gz: 43ddc80116ddeeddb5d4b268a0252c99f9bd2411
4
- data.tar.gz: 7c1fb3ba541ddd2466645fcd0b553453279e6d8a
2
+ SHA256:
3
+ metadata.gz: 99d0f57a8945d19de1d21ecffbcbe8235fc1229c56c60a96a7185f5c7a61978e
4
+ data.tar.gz: 3f4f7d2549acea5d6364a52fa0a9a1bbfec5310550c1d835c0ef0939882b5858
5
5
  SHA512:
6
- metadata.gz: 4ad8c46c69e7809dcfdaac6ba7a8eef114cc33ea2861bedf3c28d1093f6d316c92fbbfdf73c8d2bb9cfcf900fb407898f66c74228e31f63ca64fc0ec9f598dea
7
- data.tar.gz: db1e4a89c70313c28e4af53d268aae8233cb657cbbacc3b37430bd16bc57301173e4823e0204dfa59dfa90e3a150ef9be35df4247073038f4dee3b5af56da25a
6
+ metadata.gz: 6be198a0a1d514596f07fdc5b971eb795df5383f562863067e0143765c07c0c41b578ae2b1063c03bcdab52d56bbf7586b4a85f2e7b6563262bc0a180a9fede0
7
+ data.tar.gz: 7c5f93e0a6b05dca37b88d9edbefd117720d0aee61b2dd2dff154c7b370e3aef9e4c2014b64b234acd62892f07c29cc2bd215da976496fb43e3fda49c1e37572
@@ -0,0 +1,8 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
6
+ coverage
7
+ doc
8
+ .yardoc
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 2.2.0
5
+ - rbx
6
+ - ree
7
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rspec", "< 3.0"
6
+ gem "rake", "< 10"
data/Rakefile CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
-
3
+
4
4
  Bundler.require :default, :development
5
5
 
6
- require "#{File.dirname(__FILE__)}/tasks/distribution"
7
- require "#{File.dirname(__FILE__)}/tasks/testing"
6
+ require_relative "./tasks/distribution"
7
+ require_relative "./tasks/testing"
8
8
 
9
9
  task :default => :spec
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "fakeweb-matcher"
5
+ spec.version = "1.2.4"
6
+ spec.authors = ["Pat Allan"]
7
+ spec.email = ["pat@freelancing-gods.com"]
8
+
9
+ spec.homepage = "http://github.com/pat/fakeweb-matcher"
10
+ spec.summary = "RSpec matcher for the FakeWeb library"
11
+
12
+ spec.files = `git ls-files -z`.split("\x0").reject do |file|
13
+ file.match(%r{^(test|spec|features)/})
14
+ end
15
+ spec.bindir = "exe"
16
+ spec.executables = spec.files.grep(%r{^exe/}) { |file| File.basename(file) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency "fakeweb", ">= 1.2.5"
20
+ spec.add_runtime_dependency "rspec", ">= 1.2.0"
21
+
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "yard", "~> 0.9.11"
24
+ end
@@ -58,7 +58,7 @@ module FakeWebMatcher
58
58
  regex?(@url) ? regex_failure_message : url_failure_message
59
59
  end
60
60
 
61
- # Failure message if the URI should not have been requested.
61
+ # Failure message if the URI should not have been requested. (Deprecated)
62
62
  #
63
63
  # @return [String] failure message
64
64
  #
@@ -66,6 +66,14 @@ module FakeWebMatcher
66
66
  regex?(@url) ? regex_negative_failure_message : url_negative_failure_message
67
67
  end
68
68
 
69
+ # Failure message if the URI should not have been requested.
70
+ #
71
+ # @return [String] failure message
72
+ #
73
+ def failure_message_when_negated
74
+ regex?(@url) ? regex_negative_failure_message : url_negative_failure_message
75
+ end
76
+
69
77
  private
70
78
 
71
79
  def regex_negative_failure_message
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc 'Generate documentation'
4
+ YARD::Rake::YardocTask.new
5
+
6
+ task :rdoc => :yardoc
@@ -0,0 +1,6 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task :default => :test
6
+ task :test => :spec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakeweb-matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2014-12-28 00:00:00.000000000 Z
11
+ date: 2019-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakeweb
@@ -38,71 +38,56 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.2.0
41
- - !ruby/object:Gem::Dependency
42
- name: jeweler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '='
46
- - !ruby/object:Gem::Version
47
- version: 1.7.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '='
53
- - !ruby/object:Gem::Version
54
- version: 1.7.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - '='
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 0.8.7
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - '='
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 0.8.7
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: yard
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '='
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 0.7.2
61
+ version: 0.9.11
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '='
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 0.7.2
68
+ version: 0.9.11
83
69
  description:
84
- email: pat@freelancing-gods.com
70
+ email:
71
+ - pat@freelancing-gods.com
85
72
  executables: []
86
73
  extensions: []
87
- extra_rdoc_files:
88
- - LICENSE
89
- - README.textile
74
+ extra_rdoc_files: []
90
75
  files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
91
79
  - LICENSE
92
80
  - README.textile
93
81
  - Rakefile
94
- - VERSION.yml
82
+ - fakeweb-matcher.gemspec
95
83
  - lib/fake_web_matcher.rb
96
84
  - lib/fake_web_matcher/extension.rb
97
85
  - lib/fake_web_matcher/matchers.rb
98
86
  - lib/fake_web_matcher/request_matcher.rb
99
87
  - lib/fakeweb_matcher.rb
100
- - spec/lib/fake_web_matcher/extension_spec.rb
101
- - spec/lib/fake_web_matcher/matchers_spec.rb
102
- - spec/lib/fake_web_matcher/request_matcher_spec.rb
103
- - spec/lib/fake_web_matcher_spec.rb
104
- - spec/spec_helper.rb
105
- homepage: http://github.com/freelancing-god/fakeweb-matcher
88
+ - tasks/distribution.rb
89
+ - tasks/testing.rb
90
+ homepage: http://github.com/pat/fakeweb-matcher
106
91
  licenses: []
107
92
  metadata: {}
108
93
  post_install_message:
@@ -120,15 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
105
  - !ruby/object:Gem::Version
121
106
  version: '0'
122
107
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.2.2
108
+ rubygems_version: 3.0.3
125
109
  signing_key:
126
110
  specification_version: 4
127
111
  summary: RSpec matcher for the FakeWeb library
128
- test_files:
129
- - spec/lib/fake_web_matcher/extension_spec.rb
130
- - spec/lib/fake_web_matcher/matchers_spec.rb
131
- - spec/lib/fake_web_matcher/request_matcher_spec.rb
132
- - spec/lib/fake_web_matcher_spec.rb
133
- - spec/spec_helper.rb
134
- has_rdoc:
112
+ test_files: []
@@ -1,4 +0,0 @@
1
- ---
2
- :major: 1
3
- :minor: 2
4
- :patch: 3
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakeWebMatcher::Extension do
4
- it "should be included into the FakeWeb::Registry class" do
5
- FakeWeb::Registry.included_modules.should include(FakeWebMatcher::Extension)
6
- end
7
-
8
- describe '#requests' do
9
- it "should return an empty Array by default" do
10
- FakeWeb::Registry.instance.requests.should == []
11
- end
12
- end
13
-
14
- describe '#clear_requests' do
15
- it "should clear the requests array" do
16
- registry = FakeWeb::Registry.instance
17
- registry.requests << :something
18
- registry.requests.should == [:something]
19
-
20
- registry.clear_requests
21
- registry.requests.should == []
22
- end
23
- end
24
-
25
- describe '#response_for' do
26
- before :each do
27
- @registry = FakeWeb::Registry.instance
28
- end
29
-
30
- it "should track request" do
31
- @registry.response_for(:any, 'http://uri.com')
32
-
33
- @registry.requests.should == [[:any, 'http://uri.com']]
34
- end
35
-
36
- it "should return the underlying response from response_without_request_tracking" do
37
- @registry.stub!(:response_without_request_tracking => :response)
38
-
39
- @registry.response_for(:any, 'http://uri.com').should == :response
40
- end
41
- end
42
- end
@@ -1,42 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakeWebMatcher::Matchers do
4
- describe '#have_requested' do
5
- before :each do
6
- class Matchbox
7
- include FakeWebMatcher::Matchers
8
- end
9
-
10
- @matcher = Matchbox.new.have_requested(:put, 'http://url.com')
11
- end
12
-
13
- it "should return an instance of RequestMatcher" do
14
- @matcher.should be_a(FakeWebMatcher::RequestMatcher)
15
- end
16
-
17
- it "should set the url and method using the matcher arguments" do
18
- @matcher.url.to_s.should == 'http://url.com'
19
- @matcher.method.should == :put
20
- end
21
- end
22
-
23
- it "should pass if the request has been made" do
24
- FakeWeb.register_uri(:get, 'http://example.com/', :body => 'foo')
25
- open('http://example.com/')
26
-
27
- FakeWeb.should have_requested(:get, 'http://example.com')
28
- end
29
-
30
- it "should pass if the request has not been made" do
31
- FakeWeb.register_uri(:get, 'http://example.com/', :body => 'foo')
32
-
33
- FakeWeb.should_not have_requested(:get, 'http://example.com')
34
- end
35
-
36
- it "should not care about the order of the query parameters" do
37
- FakeWeb.register_uri(:get, URI.parse('http://example.com/page?foo=bar&baz=qux'), :body => 'foo')
38
- open('http://example.com/page?baz=qux&foo=bar')
39
-
40
- FakeWeb.should have_requested(:get, 'http://example.com/page?foo=bar&baz=qux')
41
- end
42
- end
@@ -1,123 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakeWebMatcher::RequestMatcher do
4
- describe '#initialize' do
5
- it "should set the url if no method is supplied" do
6
- matcher = FakeWebMatcher::RequestMatcher.new('http://example.com')
7
- matcher.url.to_s.should == 'http://example.com'
8
- end
9
-
10
- it "set the url if a method is explicitly supplied" do
11
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://example.com')
12
- matcher.url.to_s.should == 'http://example.com'
13
- end
14
-
15
- it "should set the method to any if not supplied" do
16
- matcher = FakeWebMatcher::RequestMatcher.new('http://example.com')
17
- matcher.method.should == :any
18
- end
19
-
20
- it "set the method if explicitly supplied" do
21
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://example.com')
22
- matcher.method.should == :get
23
- end
24
- end
25
-
26
- describe '#matches?' do
27
- before :each do
28
- FakeWeb.register_uri(:get, 'http://example.com/', :body => 'foo')
29
- open('http://example.com/')
30
- end
31
-
32
- it "should return true if same url and any method" do
33
- matcher = FakeWebMatcher::RequestMatcher.new('http://example.com')
34
- matcher.matches?(FakeWeb).should be_true
35
- end
36
-
37
- it "should return true if same url and same explicit method" do
38
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://example.com')
39
- matcher.matches?(FakeWeb).should be_true
40
- end
41
-
42
- it "should return false if same url and different explicit method" do
43
- matcher = FakeWebMatcher::RequestMatcher.new(:post, 'http://example.com')
44
- matcher.matches?(FakeWeb).should be_false
45
- end
46
-
47
- it "should return false if different url and same method" do
48
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://domain.com')
49
- matcher.matches?(FakeWeb).should be_false
50
- end
51
-
52
- it "should return false if different url and different explicit method" do
53
- matcher = FakeWebMatcher::RequestMatcher.new(:post, 'http://domain.com')
54
- matcher.matches?(FakeWeb).should be_false
55
- end
56
-
57
- describe "matching url is regular expression" do
58
- it "should return true if expression matches" do
59
- matcher = FakeWebMatcher::RequestMatcher.new(:get, /example/)
60
- matcher.matches?(FakeWeb).should be_true
61
- end
62
-
63
- it "should return false if don't match" do
64
- matcher = FakeWebMatcher::RequestMatcher.new(:get, /domain/)
65
- matcher.matches?(FakeWeb).should be_false
66
- end
67
-
68
- end
69
- end
70
-
71
- describe '#failure_message' do
72
- it "should mention the method if explicitly set" do
73
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://example.com')
74
- matcher.failure_message.
75
- should == 'The URL http://example.com was not requested using GET.'
76
- end
77
-
78
- it "should not mention the method if not explicitly set" do
79
- matcher = FakeWebMatcher::RequestMatcher.new('http://example.com')
80
- matcher.failure_message.
81
- should == 'The URL http://example.com was not requested.'
82
- end
83
-
84
- it "should mention failing match" do
85
- matcher = FakeWebMatcher::RequestMatcher.new(/example.com/)
86
- matcher.failure_message.
87
- should == 'A URL that matches /example.com/ was not requested.'
88
- end
89
-
90
- it "should mention failing match with method if set" do
91
- matcher = FakeWebMatcher::RequestMatcher.new(:get, /example.com/)
92
- matcher.failure_message.
93
- should == 'A URL that matches /example.com/ was not requested using GET.'
94
- end
95
- end
96
-
97
- describe '#negative_failure_message' do
98
- it "should mention the method if explicitly set" do
99
- matcher = FakeWebMatcher::RequestMatcher.new(:get, 'http://example.com')
100
- matcher.negative_failure_message.
101
- should == 'The URL http://example.com was requested using GET and should not have been.'
102
- end
103
-
104
- it "should not mention the method if not explicitly set" do
105
- matcher = FakeWebMatcher::RequestMatcher.new('http://example.com')
106
- matcher.negative_failure_message.
107
- should == 'The URL http://example.com was requested and should not have been.'
108
- end
109
-
110
- it "should mention unexpected match" do
111
- matcher = FakeWebMatcher::RequestMatcher.new(/example.com/)
112
- matcher.negative_failure_message.
113
- should == 'A URL that matches /example.com/ was requested and should not have been.'
114
- end
115
-
116
- it "should mention unexpected match with method if set" do
117
- matcher = FakeWebMatcher::RequestMatcher.new(:get, /example.com/)
118
- matcher.negative_failure_message.
119
- should == 'A URL that matches /example.com/ was requested using GET and should not have been.'
120
- end
121
-
122
- end
123
- end
@@ -1,5 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FakeWebMatcher do
4
- #
5
- end
@@ -1,11 +0,0 @@
1
- $:.unshift File.dirname(__FILE__) + '/../lib'
2
- $:.unshift File.dirname(__FILE__) + '/.'
3
-
4
- require 'rubygems'
5
- require 'bundler'
6
-
7
- Bundler.require :default, :development
8
-
9
- require 'open-uri'
10
- require 'fake_web'
11
- require 'fake_web_matcher'