Skip to content

Commit 3fa0e3d

Browse files
author
Trung Lê
committed
Bump RSpec to 3.4.0
1 parent 6bc6094 commit 3fa0e3d

File tree

7 files changed

+78
-77
lines changed

7 files changed

+78
-77
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--colour
2+
--format progress

Rakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require "rspec/core/rake_task"
88

99
RSpec::Core::RakeTask.new(:spec) do |t|
1010
t.pattern = 'spec/**/*_spec.rb'
11-
t.rspec_opts = ["--colour", "--format", "nested"]
1211
end
1312

1413
task :default => :spec

representative.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
1414
gem.version = Representative::VERSION.dup
1515
gem.platform = Gem::Platform::RUBY
1616

17-
gem.add_development_dependency("rspec", "~> 2.13.0")
17+
gem.add_development_dependency("rspec", "~> 3.4.0")
1818
gem.add_runtime_dependency("activesupport-json_encoder", ">= 1.1.0")
1919
gem.add_runtime_dependency("i18n", ">= 0.4.1")
2020
gem.add_runtime_dependency("builder", ">= 2.1.2")

spec/representative/json_spec.rb

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def resulting_json
2020

2121
it "outputs the value as JSON" do
2222
r.element :name, "Fred"
23-
resulting_json.should == %{"Fred"\n}
23+
expect(resulting_json).to eq %{"Fred"\n}
2424
end
2525

2626
end
@@ -29,7 +29,7 @@ def resulting_json
2929

3030
it "outputs the value as JSON" do
3131
r.element :age, 36
32-
resulting_json.should == "36\n"
32+
expect(resulting_json).to eq "36\n"
3333
end
3434

3535
end
@@ -38,7 +38,7 @@ def resulting_json
3838

3939
it "generates null" do
4040
r.element :flavour, nil
41-
resulting_json.should == "null\n"
41+
expect(resulting_json).to eq "null\n"
4242
end
4343

4444
describe "and a block" do
@@ -47,7 +47,7 @@ def resulting_json
4747
r.element :book, nil do
4848
r.element :author
4949
end
50-
resulting_json.should == "null\n"
50+
expect(resulting_json).to eq "null\n"
5151
end
5252

5353
end
@@ -63,7 +63,7 @@ def resulting_json
6363
r.element :book, @book, :lang => :lang do
6464
r.element :title
6565
end
66-
resulting_json.should == undent(<<-JSON)
66+
expect(resulting_json).to eq undent(<<-JSON)
6767
{
6868
"@lang": "fr",
6969
"title": "En Edge"
@@ -77,7 +77,7 @@ def resulting_json
7777

7878
it "ignores the attributes" do
7979
r.element :review, "Blah de blah", :lang => "fr"
80-
resulting_json.should == undent(<<-JSON)
80+
expect(resulting_json).to eq undent(<<-JSON)
8181
"Blah de blah"
8282
JSON
8383
end
@@ -93,7 +93,7 @@ def resulting_json
9393
r.representing(@author) do
9494
r.element :name
9595
end
96-
resulting_json.should == %{"Fred"\n}
96+
expect(resulting_json).to eq %{"Fred"\n}
9797
end
9898

9999
end
@@ -103,7 +103,7 @@ def resulting_json
103103
it "outputs an object" do
104104
r.element :something, Object.new do
105105
end
106-
resulting_json.should == "{}\n"
106+
expect(resulting_json).to eq "{}\n"
107107
end
108108

109109
end
@@ -116,7 +116,7 @@ def resulting_json
116116

117117
it "outputs the array as JSON" do
118118
r.list_of :names, %w(Hewey Dewey Louie)
119-
resulting_json.should == undent(<<-JSON)
119+
expect(resulting_json).to eq undent(<<-JSON)
120120
[
121121
"Hewey",
122122
"Dewey",
@@ -134,7 +134,7 @@ def resulting_json
134134
r.element(:duck, @donald) do
135135
r.list_of :nephews
136136
end
137-
resulting_json.should == undent(<<-JSON)
137+
expect(resulting_json).to eq undent(<<-JSON)
138138
{
139139
"nephews": [
140140
"Hewey",
@@ -159,7 +159,7 @@ def resulting_json
159159
r.element :name
160160
r.element :age
161161
end
162-
resulting_json.should == undent(<<-JSON)
162+
expect(resulting_json).to eq undent(<<-JSON)
163163
[
164164
{
165165
"name": "Hewey",
@@ -190,7 +190,7 @@ def resulting_json
190190
r.element :name
191191
r.element :age
192192
end
193-
resulting_json.should == undent(<<-JSON)
193+
expect(resulting_json).to eq undent(<<-JSON)
194194
[
195195
{
196196
"@about": "Hewey is 3 years old",
@@ -215,16 +215,18 @@ def resulting_json
215215
describe "with list attributes" do
216216
it "raises an ArgumentError" do
217217
@authors = []
218-
lambda{ r.list_of(:authors, @authors, :list_attributes => {}) {} }.should raise_exception(ArgumentError)
218+
expect(-> {
219+
r.list_of(:authors, @authors, :list_attributes => {}) {}
220+
}).to raise_exception(ArgumentError)
219221
end
220222
end
221223

222224
describe "with unnecessary arguments" do
223225
it "raises an ArgumentError" do
224226
@authors = []
225-
lambda{
227+
expect(-> {
226228
r.list_of(:authors, @authors, :unecessary_arg_should_cause_failure, :item_attributes => {}){}
227-
}.should raise_exception(ArgumentError)
229+
}).to raise_exception(ArgumentError)
228230
end
229231
end
230232

@@ -234,7 +236,7 @@ def resulting_json
234236

235237
it "inserts a comment" do
236238
r.comment "now pay attention"
237-
resulting_json.should == undent(<<-JSON)
239+
expect(resulting_json).to eq undent(<<-JSON)
238240
// now pay attention
239241
JSON
240242
end
@@ -252,7 +254,7 @@ def resulting_json
252254
r.element :name, "Fred"
253255
r.element :age, 36
254256
end
255-
resulting_json.should == undent(<<-JSON)
257+
expect(resulting_json).to eq undent(<<-JSON)
256258
{
257259
"name": "Fred",
258260
"age": 36
@@ -268,7 +270,7 @@ def resulting_json
268270
r.element :name
269271
r.element :age
270272
end
271-
resulting_json.should == undent(<<-JSON)
273+
expect(resulting_json).to eq undent(<<-JSON)
272274
{
273275
"name": "Fred",
274276
"age": 36
@@ -287,7 +289,7 @@ def resulting_json
287289
r.attribute :href, "http://example.com/authors/1"
288290
r.element :name, "Fred"
289291
end
290-
resulting_json.should == undent(<<-JSON)
292+
expect(resulting_json).to eq undent(<<-JSON)
291293
{
292294
"@href": "http://example.com/authors/1",
293295
"name": "Fred"
@@ -306,7 +308,7 @@ def resulting_json
306308
r.comment "age is irrelevant"
307309
r.element :age
308310
end
309-
resulting_json.should == undent(<<-JSON)
311+
expect(resulting_json).to eq undent(<<-JSON)
310312
{
311313
"name": "Fred",
312314
// age is irrelevant
@@ -325,7 +327,7 @@ def resulting_json
325327
r.element :user, Object.new do
326328
r.element :full_name, "Fred Bloggs"
327329
end
328-
resulting_json.should == undent(<<-JSON)
330+
expect(resulting_json).to eq undent(<<-JSON)
329331
{
330332
"full_name": "Fred Bloggs"
331333
}
@@ -342,7 +344,7 @@ def resulting_json
342344
r.attribute :alt_url, "http://xyz.com"
343345
r.element :full_name
344346
end
345-
resulting_json.should == undent(<<-JSON)
347+
expect(resulting_json).to eq undent(<<-JSON)
346348
{
347349
"@altUrl": "http://xyz.com",
348350
"fullName": "Fred Bloggs"
@@ -368,7 +370,7 @@ def resulting_json
368370
r.element :name
369371
r.element :age
370372
end
371-
resulting_json.should == undent(<<-JSON)
373+
expect(resulting_json).to eq undent(<<-JSON)
372374
[
373375
{
374376
"name": "Hewey",
@@ -391,7 +393,7 @@ def resulting_json
391393
r.element :name
392394
r.element :age
393395
end
394-
resulting_json.should == undent(<<-JSON)
396+
expect(resulting_json).to eq undent(<<-JSON)
395397
[
396398
\t{
397399
\t\t"name": "Hewey",
@@ -414,7 +416,7 @@ def resulting_json
414416
r.element :name
415417
r.element :age
416418
end
417-
resulting_json.should == %([{"name":"Hewey","age":3},{"name":"Dewey","age":4}])
419+
expect(resulting_json).to eq %([{"name":"Hewey","age":3},{"name":"Dewey","age":4}])
418420
end
419421

420422
end

spec/representative/nokogiri_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def resulting_xml
2929
r.element :person, @subject do
3030
r.attribute :name
3131
end
32-
resulting_xml.should == %(<person name="Fred"/>)
32+
expect(resulting_xml).to eq %(<person name="Fred"/>)
3333
end
3434
end
3535

@@ -38,32 +38,32 @@ def resulting_xml
3838
r.element :person, @subject do
3939
r.attribute :lang, "fr"
4040
end
41-
resulting_xml.should == %(<person lang="fr"/>)
41+
expect(resulting_xml).to eq %(<person lang="fr"/>)
4242
end
4343
end
4444

4545
describe "with a value that supports #to_proc" do
4646
it "calls the Proc on the subject to generate attribute value" do
4747
r.element :person, @subject do
48-
r.attribute :name, lambda { |person| person.name.reverse }
48+
r.attribute :name, lambda { |person| person.name.reverse }
4949
end
50-
resulting_xml.should == %(<person name="derF"/>)
50+
expect(resulting_xml).to eq %(<person name="derF"/>)
5151
end
5252
end
5353

5454
it "dasherizes the attribute name" do
5555
r.element :name do
5656
r.attribute :sourced_from, "phonebook"
5757
end
58-
resulting_xml.should == %(<name sourced-from="phonebook"/>)
58+
expect(resulting_xml).to eq %(<name sourced-from="phonebook"/>)
5959
end
6060

6161
describe "with value nil" do
6262
it "omits the attribute" do
6363
r.element :person, @subject do
6464
r.attribute :name, nil
6565
end
66-
resulting_xml.should == %(<person/>)
66+
expect(resulting_xml).to eq %(<person/>)
6767
end
6868
end
6969

spec/representative/tilt_integration_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def resulting_xml
2626
r.element :foo, "bar"
2727
RUBY
2828
render
29-
resulting_xml.should == %{<foo>bar</foo>\n}
29+
expect(resulting_xml).to eq %{<foo>bar</foo>\n}
3030
end
3131

3232
it "provides access to scope" do
@@ -43,7 +43,7 @@ def resulting_xml
4343
end
4444
render(scope)
4545

46-
resulting_xml.should == undent(<<-XML)
46+
expect(resulting_xml).to eq undent(<<-XML)
4747
<author>
4848
<name>Mike</name>
4949
</author>
@@ -61,7 +61,7 @@ def resulting_xml
6161

6262
render(Object.new, {:author => OpenStruct.new(:name => "Mike")})
6363

64-
resulting_xml.should == undent(<<-XML)
64+
expect(resulting_xml).to eq undent(<<-XML)
6565
<author>
6666
<name>Mike</name>
6767
</author>
@@ -72,7 +72,7 @@ def resulting_xml
7272
end
7373

7474
end
75-
75+
7676
describe "JSON template" do
7777

7878
def resulting_json
@@ -86,7 +86,7 @@ def resulting_json
8686
r.element :foo, "bar"
8787
RUBY
8888
render
89-
resulting_json.should == %{"bar"\n}
89+
expect(resulting_json).to eq %{"bar"\n}
9090
end
9191

9292
it "provides access to scope" do
@@ -103,7 +103,7 @@ def resulting_json
103103
end
104104
render(scope)
105105

106-
resulting_json.should == undent(<<-JSON)
106+
expect(resulting_json).to eq undent(<<-JSON)
107107
{
108108
"name": "Mike"
109109
}
@@ -121,7 +121,7 @@ def resulting_json
121121

122122
render(Object.new, {:author => OpenStruct.new(:name => "Mike")})
123123

124-
resulting_json.should == undent(<<-JSON)
124+
expect(resulting_json).to eq undent(<<-JSON)
125125
{
126126
"name": "Mike"
127127
}

0 commit comments

Comments
 (0)