-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCHANGELOG
105 lines (69 loc) · 3.47 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
* Allow should route(:get, :action => :show, :id => 1).to("/projects/1") and
should route(:get, "/projects/1").from(:action => :show, :id => 1) syntax.
* Plugin files are automatically loaded [#86]
* Allow should_route to use environment configuration [#88] (thanks to Lawrence Pit)
* Allow mock model class to be set using :as option.
* [DEPRECATION] By default all matchers perform expectations, use with_stubs => true
if you want otherwise.
* [DEPRECATION] mock_models now creates model_proc instead of mock_model.
Altough this won't fire any deprecation warning, all the documentation was changed.
* assert_valid_keys on expects
* mock_models now creates a second class method to be used on the index action [#71]
In other words, mock_models :project will create:
def self.mock_project
proc { mock_project }
end
# This was added to be used on index actions
def self.mock_projects
proc { [ mock_project ] }
end
def mock_project(stubs={})
@project ||= mock_model(Project, stubs)
end
* Allow multiple args to be given to :with in expects. If you need to verify that
an array is being sent, you need to send an array inside another array [#70]
* Allow procs or blocks to be given to respond_with_body and respond_with :body [#67]
* Allow ordered to be given to macro stubs as option [#66]
# v3.1
* Ensure set_cookies and set_session work with arrays [#55]
* Added set_cookies matcher [#51]
* Add a helper to declare that a XmlHttpRequest should be performed:
describe :get => :show do
xhr!
* Macro stubs now supports blocks too [#50]
expects :human_attribute_name, :on => Project, :with => :title do |attr|
attr.to_s.humanize
end
* :to option in set_session and set_the_flash now accepts Regexp [#46]
* render_template now works with partials [#43]
* Added to support for routing example group (inside spec/routing) [#26]
# v3.0
* redirect_to and render_template were ported from rspec-rails to
remarkable to provide I18n. The second was also extended to deal with :with,
:layout and :content_type as options.
render_with_layout, render_without_layout delegate their logic to render_template
so they share the same options.
respond_with_content_type and respond_wity_body delegate their logic to
respond_with matcher, so they also share the same options.
:set_the_flash was also redesign to inherit from :set_session, providing a
consistent API.
* remarkable_rails now ships with a new feature, called macro stubs.
This allows you to declare just once your mocks and/or expectations, and each
matcher will know how to deal with properly. A TasksController could have your
specs for a create action rewritten like this:
describe TasksController do
mock_models :task
describe :post => :create, :task => { :these => 'params' } do
expects :new, :on => Task, with => {'these' => 'params'}, :returns => task_proc
expects :save, :on => mock_task, :returns => true
should_assign_to :task, :with => task_proc
should_redirect_to { task_url(mock_task) }
end
end
It automatically performs the action before running each macro. In assign_to,
it executes the expects as expectations (:should_receive), and in redirect_to
it executes the expects as stubs (:stub!), just as above.
For more options, information and configuration, check macro stubs documentation.
# v2.x
* Added assign_to, filter_params, render_with_layout, respond_with
respond_with_content_type, route, set_session and set_the_flash matchers.