Codebase list ruby-seed-fu / eb57ed7
Patch for fixing the RSpec deprecated syntax Signed-off-by: Jongmin Kim <jmkim@pukyong.ac.kr> Jongmin Kim 4 years ago
3 changed file(s) with 184 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
77 rake,
88 ruby-activerecord (>= 3.1),
99 ruby-activesupport (>= 3.1),
10 ruby-rspec,
10 ruby-rspec (>= 2.11),
1111 ruby-sqlite3
1212 Standards-Version: 4.3.0
1313 Vcs-Git: https://salsa.debian.org/ruby-team/ruby-seed-fu.git
0 Description: Replace RSpec syntax "should" with "expect"
1 `:should` syntax without explicitly enabling the syntax is deprecated in
2 RSpec. This patch will replace `:should` syntax with `#expect`, which
3 introduced in RSpec 2.11.
4 Author: Jongmin Kim <jmkim@pukyong.ac.kr>
5 Forwarded: https://github.com/mbleigh/seed-fu/pull/137
6 Last-Update: 2019-08-29
7 --- a/spec/runner_spec.rb
8 +++ b/spec/runner_spec.rb
9 @@ -4,21 +4,21 @@
10 it "should seed data from Ruby and gzipped Ruby files in the given fixtures directory" do
11 SeedFu.seed(File.dirname(__FILE__) + '/fixtures')
12
13 - SeededModel.find(1).title.should == "Foo"
14 - SeededModel.find(2).title.should == "Bar"
15 - SeededModel.find(3).title.should == "Baz"
16 + expect(SeededModel.find(1).title).to eq("Foo")
17 + expect(SeededModel.find(2).title).to eq("Bar")
18 + expect(SeededModel.find(3).title).to eq("Baz")
19 end
20
21 it "should seed only the data which matches the filter, if one is given" do
22 SeedFu.seed(File.dirname(__FILE__) + '/fixtures', /_2/)
23
24 - SeededModel.count.should == 1
25 - SeededModel.find(2).title.should == "Bar"
26 + expect(SeededModel.count).to eq(1)
27 + expect(SeededModel.find(2).title).to eq("Bar")
28 end
29
30 it "should use the SpecFu.fixtures_path variable to determine where fixtures are" do
31 SeedFu.fixture_paths = [File.dirname(__FILE__) + '/fixtures']
32 SeedFu.seed
33 - SeededModel.count.should == 3
34 + expect(SeededModel.count).to eq(3)
35 end
36 end
37 --- a/spec/seeder_spec.rb
38 +++ b/spec/seeder_spec.rb
39 @@ -20,12 +20,12 @@
40 end
41
42 bob = SeededModel.find_by_id(-2)
43 - bob.first_name.should == "Bob"
44 - bob.last_name.should == "Bobson"
45 + expect(bob.first_name).to eq("Bob")
46 + expect(bob.last_name).to eq("Bobson")
47
48 if ENV['DB'] == 'postgresql'
49 next_id = SeededModel.connection.execute("select nextval('seeded_models_id_seq')")
50 - next_id[0]['nextval'].to_i.should == 11
51 + expect(next_id[0]['nextval'].to_i).to eq(11)
52 end
53 end
54
55 @@ -39,8 +39,8 @@
56 end
57
58 bob = SeededModel.find_by_id(5)
59 - bob.first_name.should == "Bob"
60 - bob.last_name.should == "Bobson"
61 + expect(bob.first_name).to eq("Bob")
62 + expect(bob.last_name).to eq("Bobson")
63 end
64
65 it "should be able to handle multiple constraints" do
66 @@ -50,7 +50,7 @@
67 s.first_name = "Bob"
68 end
69
70 - SeededModel.count.should == 1
71 + expect(SeededModel.count).to eq(1)
72
73 SeededModel.seed(:title, :login) do |s|
74 s.login = "frank"
75 @@ -58,15 +58,15 @@
76 s.first_name = "Frank"
77 end
78
79 - SeededModel.count.should == 2
80 + expect(SeededModel.count).to eq(2)
81
82 - SeededModel.find_by_login("bob").first_name.should == "Bob"
83 + expect(SeededModel.find_by_login("bob").first_name).to eq("Bob")
84 SeededModel.seed(:title, :login) do |s|
85 s.login = "bob"
86 s.title = "Peon"
87 s.first_name = "Steve"
88 end
89 - SeededModel.find_by_login("bob").first_name.should == "Steve"
90 + expect(SeededModel.find_by_login("bob").first_name).to eq("Steve")
91 end
92
93 it "should be able to create models from an array of seed attributes" do
94 @@ -76,9 +76,9 @@
95 {:login => "harry", :title => "Noble", :first_name => "Harry"}
96 ])
97
98 - SeededModel.find_by_login("bob").first_name.should == "Steve"
99 - SeededModel.find_by_login("frank").first_name.should == "Francis"
100 - SeededModel.find_by_login("harry").first_name.should == "Harry"
101 + expect(SeededModel.find_by_login("bob").first_name).to eq("Steve")
102 + expect(SeededModel.find_by_login("frank").first_name).to eq("Francis")
103 + expect(SeededModel.find_by_login("harry").first_name).to eq("Harry")
104 end
105
106 it "should be able to create models from a list of seed attribute hashes at the end of the args" do
107 @@ -88,9 +88,9 @@
108 {:login => "harry", :title => "Noble", :first_name => "Harry"}
109 )
110
111 - SeededModel.find_by_login("bob").first_name.should == "Steve"
112 - SeededModel.find_by_login("frank").first_name.should == "Francis"
113 - SeededModel.find_by_login("harry").first_name.should == "Harry"
114 + expect(SeededModel.find_by_login("bob").first_name).to eq("Steve")
115 + expect(SeededModel.find_by_login("frank").first_name).to eq("Francis")
116 + expect(SeededModel.find_by_login("harry").first_name).to eq("Harry")
117 end
118
119 it "should update, not create, if constraints are met" do
120 @@ -111,8 +111,8 @@
121 end
122
123 bob = SeededModel.find_by_id(1)
124 - bob.first_name.should == "Robert"
125 - bob.last_name.should == "Bobson"
126 + expect(bob.first_name).to eq("Robert")
127 + expect(bob.last_name).to eq("Bobson")
128 end
129
130 it "should create but not update with seed_once" do
131 @@ -133,15 +133,15 @@
132 end
133
134 bob = SeededModel.find_by_id(1)
135 - bob.first_name.should == "Bob"
136 - bob.last_name.should == "Bobson"
137 + expect(bob.first_name).to eq("Bob")
138 + expect(bob.last_name).to eq("Bobson")
139 end
140
141 it "should default to an id constraint" do
142 SeededModel.seed(:title => "Bla", :id => 1)
143 SeededModel.seed(:title => "Foo", :id => 1)
144
145 - SeededModel.find(1).title.should == "Foo"
146 + expect(SeededModel.find(1).title).to eq("Foo")
147 end
148
149 it "should require that all constraints are defined" do
150 --- a/spec/writer_spec.rb
151 +++ b/spec/writer_spec.rb
152 @@ -16,8 +16,8 @@
153 end
154 load @file_name
155
156 - SeededModel.find(1).title.should == "Mr"
157 - SeededModel.find(2).title.should == "Dr"
158 + expect(SeededModel.find(1).title).to eq("Mr")
159 + expect(SeededModel.find(2).title).to eq("Dr")
160 end
161
162 it "should support chunking" do
163 @@ -28,8 +28,8 @@
164 end
165 load @file_name
166
167 - SeededModel.count.should == 3
168 - File.read(@file_name).should include("# BREAK EVAL\n")
169 + expect(SeededModel.count).to eq(3)
170 + expect(File.read(@file_name)).to include("# BREAK EVAL\n")
171 end
172
173 it "should support specifying the output to use 'seed_once' rather than 'seed'" do
174 @@ -40,6 +40,6 @@
175 end
176 load @file_name
177
178 - SeededModel.find(1).title.should == "Dr"
179 + expect(SeededModel.find(1).title).to eq("Dr")
180 end
181 end
00 bundler
11 activerecord-api-fix.patch
2 rspec-from-2-to-3.patch