dupe 1.0.1 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dupe/active_resource_extensions.rb +7 -9
- data/lib/dupe/dupe.rb +13 -7
- data/lib/dupe/hash_pruner.rb +6 -2
- data/lib/dupe/mock.rb +10 -7
- data/spec/lib_specs/active_resource_extensions_spec.rb +320 -133
- data/spec/lib_specs/dupe_spec.rb +273 -186
- data/spec/lib_specs/mock_definitions_spec.rb +101 -40
- data/spec/lib_specs/mock_spec.rb +300 -124
- data/spec/lib_specs/network_spec.rb +32 -8
- metadata +38 -62
@@ -47,14 +47,38 @@ describe Dupe::Network do
|
|
47
47
|
proc { @network.request(:delete, '/some_url')}.should raise_error(Dupe::Network::RequestNotFoundError)
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
describe "using xml" do
|
51
|
+
before :each do
|
52
|
+
Dupe.format = ActiveResource::Formats::XmlFormat
|
53
|
+
Dupe.reset
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return the appropriate mock response if a mock matches the url" do
|
57
|
+
@network.define_service_mock :get, %r{/greeting$}, proc { "hello" }
|
58
|
+
@network.request(:get, '/greeting').should == 'hello'
|
59
|
+
|
60
|
+
@network.define_service_mock :post, %r{/greeting$}, proc { |post_data| Dupe.create(:greeting, post_data) }
|
61
|
+
resp, url = @network.request(:post, '/greeting', {} )
|
62
|
+
resp.should == Dupe.find(:greeting).make_safe.to_xml(:root => 'greeting')
|
63
|
+
url.should == "/greetings/1.xml"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "using json" do
|
68
|
+
before :each do
|
69
|
+
Dupe.format = ActiveResource::Formats::JsonFormat
|
70
|
+
Dupe.reset
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should return the appropriate mock response if a mock matches the url" do
|
74
|
+
@network.define_service_mock :get, %r{/greeting$}, proc { "hello" }
|
75
|
+
@network.request(:get, '/greeting').should == 'hello'
|
76
|
+
|
77
|
+
@network.define_service_mock :post, %r{/greeting$}, proc { |post_data| Dupe.create(:greeting, post_data) }
|
78
|
+
resp, url = @network.request(:post, '/greeting', {} )
|
79
|
+
resp.should == Dupe.find(:greeting).make_safe.to_json(:root => 'greeting')
|
80
|
+
url.should == "/greetings/1.json"
|
81
|
+
end
|
58
82
|
end
|
59
83
|
end
|
60
84
|
|
metadata
CHANGED
@@ -1,60 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dupe
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0.rc1
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Matt Parker
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-03-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: activeresource
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70157716810800 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
version: "3.0"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rspec
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: *70157716810800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70157716810140 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
47
33
|
type: :development
|
48
|
-
|
49
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70157716810140
|
36
|
+
description: TDD your services outside in by starting at the client, then working
|
37
|
+
your way back to the server.
|
50
38
|
email: moonmaster9000@gmail.com
|
51
39
|
executables: []
|
52
|
-
|
53
40
|
extensions: []
|
54
|
-
|
55
41
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
files:
|
42
|
+
files:
|
58
43
|
- lib/dupe/active_resource_extensions.rb
|
59
44
|
- lib/dupe/attribute_template.rb
|
60
45
|
- lib/dupe/cucumber_hooks.rb
|
@@ -94,38 +79,29 @@ files:
|
|
94
79
|
- spec/spec_helper.rb
|
95
80
|
homepage: http://github.com/moonmaster9000/dupe
|
96
81
|
licenses: []
|
97
|
-
|
98
82
|
post_install_message:
|
99
83
|
rdoc_options: []
|
100
|
-
|
101
|
-
require_paths:
|
84
|
+
require_paths:
|
102
85
|
- lib
|
103
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
87
|
none: false
|
105
|
-
requirements:
|
106
|
-
- -
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
|
109
|
-
|
110
|
-
- 0
|
111
|
-
version: "0"
|
112
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
93
|
none: false
|
114
|
-
requirements:
|
115
|
-
- -
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
version: "0"
|
94
|
+
requirements:
|
95
|
+
- - ! '>'
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 1.3.1
|
121
98
|
requirements: []
|
122
|
-
|
123
99
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.8.
|
100
|
+
rubygems_version: 1.8.17
|
125
101
|
signing_key:
|
126
102
|
specification_version: 3
|
127
103
|
summary: Dupe - a testing library for ActiveResource
|
128
|
-
test_files:
|
104
|
+
test_files:
|
129
105
|
- spec/lib_specs/active_resource_extensions_spec.rb
|
130
106
|
- spec/lib_specs/attribute_template_spec.rb
|
131
107
|
- spec/lib_specs/database_spec.rb
|