-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCHANGELOG
227 lines (172 loc) · 9.39 KB
/
CHANGELOG
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
v1.1.0.rc1
JSON support!!! Thanks @cdmicacc! https://github.com/moonmaster9000/dupe/pull/25
v1.0.1
bug fix: correctly handle blank POST body (samsonw https://github.com/moonmaster9000/dupe/pull/24)
v1.0.0
updated specs for rails 3.1 compatibility (tomeric) (https://github.com/moonmaster9000/dupe/pull/21)
v0.5.3
when rails 3 went out of beta, the gem started install rails 3 activeresource/activemodel, because of a bug in the gemspec.
this release fixes the gemspec.
v0.5.1
includes PUT and DELETE intercept mocks (checkout the README.rdoc)
v0.5.0
includes POST intercept mocks (checkout the README.rdoc)
v0.4.9
fixes issue #6 (http://github.com/moonmaster9000/dupe/issues/issue/5)
see commit (http://github.com/moonmaster9000/dupe/commit/397fd00ca2ec51428464c8dff61c71783a621911)
v0.4.8
fixes issue #5 (http://github.com/moonmaster9000/dupe/issues/issue/5)
see commit (http://github.com/moonmaster9000/dupe/commit/d26b8f7d765522589554986e04c25906ec6e8ca8)
v0.4.7
Created a hash pruning algorithm that overcomes ActiveSupport's to_xml limitations.
Basically, this allows you to have cyclicly referential records rendered into xml.
For example:
dupe_gem = Dupe.create :gem, :name => 'dupe'
matt = Dupe.create :author, :name => 'matt'
dupe_gem.author = matt
matt.gems = [dupe_gem]
In Dupe's previous incarnations, if you had called "/authors/1.xml", you would have gotten a
"stack level too deep" error? Why? Because ActiveSupport's to_xml method for Hash objects
can't handle cyclical stuctures (in this case, dupe_gem has an author matt, who has a gem dupe_gem,
which has an author matt, who has a gem dupe_gem, etc. etc. etc. second star to the left straight
on till morning).
So I've written a HashPruner that performs a di-graph cycle detection / elimination operation
on any hash. dupe now adds a "to_xml_safe" method to hashes, which will essentially run the hash
in question through the pruner before passing itself off to ActiveSupport's "to_xml".
So now, "/authors/1.xml" will not error out on cyclical structure, but in fact return xml not unlike
ActiveRecord would have produced had these been actual relational database records.
v0.4.6
Dupe.sequence works just like Factory Girl sequences. Check the README.rdoc on github.
v0.4.5
Dupe.define now supports a uniquify method:
>> Dupe.define :book do |book|
?> book.uniquify :title, :genre, :author
>> end
=> #<Dupe::Model:0x1ab1a34 @id_sequence=#<Sequence:0x1ab19f8 @current_value=1>, @name=:book, @schema=#<Dupe::Model::Schema:0x1ab1a0c @after_create_callbacks=[#<Proc:0x01ac8338@./lib/dupe/schema.rb:40>, #<Proc:0x01ac8338@./lib/dupe/schema.rb:40>, #<Proc:0x01ac8338@./lib/dupe/schema.rb:40>], @attribute_templates={}>>
>> b = Dupe.create :book
=> <#Duped::Book author="book 1 author" title="book 1 title" genre="book 1 genre" id=1>
>> b2 = Dupe.create :book, :title => 'Rooby'
=> <#Duped::Book author="book 2 author" title="Rooby" genre="book 2 genre" id=2>
v0.4.4
Dupe.define will now create resource mocks for find(:all) and find(<id>) honoring ActiveResource self.site prefix's.
For example, before this patch:
class Author < ActiveResource::Base; self.site = 'http://my.site.com/services'; end
Dupe.define :author
--> that would have generated network mocks with url_patterns like
%r{/authors\.xml$} and %r{/authors/(\d+)\.xml$}.
Now, with this patch, the previous two lines would generate mocks responding to:
--> %r{^/services/authors\.xml$} # find :all
--> %r{^/services/authors/(\d+)\.xml$} # find <id>
v0.4.3
script/generate now does the following:
creates the following directories:
RAILS_ROOT/features/dupe
RAILS_ROOT/features/dupe/definitions
RAILS_ROOT/features/dupe/custom_mocks
it places example Dupe definitions in RAILS_ROOT/features/dupe/definitions/definitions.rb
it places example custom mocks in RAILS_ROOT/features/dupe/custom_mocks/custom_mocks.rb
it also adds a load_dupe.rb file (that loads up the definitions and custom mocks) to RAILS_ROOT/features/support/load_dupe.rb
v0.4.2
Bug fix: fixes issue #3 (http://github.com/moonmaster9000/dupe/issues/#issue/3)
v0.4.1
Bug fix: fixes issue #2 (http://github.com/moonmaster9000/dupe/issues/#issue/2)
v0.4.0
This is a major rewrite of Dupe. Under the hood, it's architecturally much more sound - and maintainable. It goes much
farther with tried and true OO design principles than previous incarnations. It also now includes a spec suite instead of
a cucumber suite (though a higher-level cucumber test suite is in the making), with code coverage above 95%.
New features include procs as default attributes, Dupe.find_or_create, and Dupe.define after_create callbacks, and
a new API for url-intercept mocks. Checkout README.rdoc for an overview.
v0.3.7
* fixing cucumber After scenario hook (broke by last patch release)
v0.3.6
* Dupe.create now returns hashes just like Dupe.find, allowing you to do this:
a = Dupe.create :author, :name => 'Andreas Eschbach'
b = Dupe.create :book, :title => 'The Carpet Makers', :author => a
v0.3.5
* added support for intercept mocking. Instead of using the clunky Dupe.define_mocks for setting up
custom mocks, you can now use the CustomMocks module. Add a .rb file to your features/support/
that looks like this
module CustomMocks
# Maps a service request url to a Dupe find. By default, Dupe will only
# mock simple requests like SomeResource.find(some_id) or SomeResource.find(:all)
#
# For example, suppose you have a Book < ActiveResource::Base class, and
# somewhere your code does:
#
# Book.find :all, :params => {:limit => 10, :offset => 20}
#
# That in turn will send off a request to a url like:
#
# /books?limit=10&offset=20
#
# In this file, you could add a "when" statement like:
#
# when %r{^/books?limit=\d+&offset=\d+$}
# start = $2.to_i
# finish = start + $1.to_i
# Dupe.find(:books)[start..finish]
#
def custom_service(url)
case url
when %r{^/books?author_id=([^&]*)$}
Dupe.find(:books) {|b| b.author.label == $1}
else
raise StandardError.new(%{There is no custom service mapping for "#{url}". Now go to features/support/custom_mocks.rb and add it.})
end
end
end
v0.3.4
* removed spurious debug output (sorry)
v0.3.3
* now supporting active resource prefixes.
For example, suppose you have an ActiveResource class like:
class Book < ActiveResource::Base
self.site = "http://library.com/restful_services"
end
Then Dupe will mock url responses prefixed with "/restful_services/", (e.g., if you
created a book record with Dupe like Dupe.create :book, :name => 'Bible', :author => 'God',
then Dupe would mock the response to "/restful_services/books.xml" with the appropriate xml)
v0.3.2
* bug fix for hasmany associations
for example, suppose you had the following definition for a book resource that has many authors:
Dupe.define :book do |book|
book.authors do |author_names|
author_names.split(', ').map {|name| Dupe.find(:author) {|a| a.name == name }}
end
end
you can now do a find like:
Dupe.find(:books) {|b| b.authors.collect {|a| a.name}.include?('some author')}
before you would have had to do:
Dupe.find(:books) {|b| b.authors.collect {|a| a[:name]}.include?('some author')}
v0.3.1
* rdoc documentation updates
v0.3.0
* bumped the minor number because this release is not backwards compatible.
* stub now works more intuitively. Suppose you had a :book resource, and you wanted to stub
20 "sci-fi" books where both the title and author were different for every resource .
Dupe.stub 20, :books, :like => {:genre => "sci-fi", :title => proc {|n| "title-#{n}"}, :author => proc {|n| "author-#{n}"}}
v0.2.3
* ruby 1.8.6 compat fix (Symbol doesn't support upcase)
v0.2.2
* patched ActiveResource::Connection.get/delete/put/post/head to log appropriate request headers in the request log.
v0.2.1
* configuration options now behave diffently if that option name is singular v. plural
for example,
Dupe.configuration :resource do |config|
config.record_identifiers :id
end
would result in the Dupe.factories[:resource].configuration.config[:record_identifiers] being set to [:id] (since
"record identifiers" is plural, it assumes you're specifying an array of values).
however,
Dupe.configuration do |global_config|
global_config.debug true
end
sets Dupe.global_configuration.config[:debug] = true (it assumes that since "debug" is singular, that configuration can
only have one value, so it doesn't bother putting it in an array).
mostly, you'll never really need to know how Dupe.configuration is storing the configuration internally.
v0.2.0
* new global configuration option "debug". will output all request attempts / mocked responses that occurred
during the course of a scenario. consult the api documentation (moonmaster9000.github.com/dupe/api) for
more information.
v0.1.2
* initial github publish. includes all the basic api: configure (factory), create, stub, define, define_mocks, find.