Skip to content

Commit d91c75a

Browse files
committed
update specs/features using deprecated syntax
1 parent a06663b commit d91c75a

3 files changed

Lines changed: 41 additions & 49 deletions

File tree

features/step_definitions/scorm_cloud_steps.rb

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Generic
33
##
44
Then /^I will get a valid url$/ do
5-
@last_url.should match(/http\:\/\/.+/)
5+
expect(@last_url).to match(/http\:\/\/.+/)
66
end
77

88

@@ -23,11 +23,11 @@
2323
end
2424

2525
Then /^the response should be "([^"]*)"$/ do |arg1| #"
26-
@last_response.should eq(arg1)
26+
expect(@last_response).to eq(arg1)
2727
end
2828

2929
Then /^the resonse should be the current time$/ do
30-
@last_response.should match(/\d+/)
30+
expect(@last_response).to match(/\d+/)
3131
end
3232

3333
##
@@ -36,21 +36,21 @@
3636

3737
When /^I upload a package$/ do
3838
token = @c.upload.get_upload_token
39-
token.should_not be_nil
39+
expect(token).to_not be_nil
4040
path = File.join(File.dirname(__FILE__), '..', '..', 'spec', 'small_scorm_package.zip')
4141
@last_upload_path = @c.upload.upload_file(token, path)
4242
@last_uploaded_dir, @last_uploaded_file = @last_upload_path.split('/')
43-
@last_uploaded_file.should include('.zip')
43+
expect(@last_uploaded_file).to include('.zip')
4444
end
4545

4646
Then /^the package files should be available$/ do
4747
list = @c.upload.list_files.map { |f| f[:file] }
48-
list.should include(@last_uploaded_file)
48+
expect(list).to include(@last_uploaded_file)
4949
end
5050

5151
Then /^the package files should not be available$/ do
5252
list = @c.upload.list_files.map { |f| f[:file] }
53-
list.should_not include(@last_uploaded_file)
53+
expect(list).to_not include(@last_uploaded_file)
5454
end
5555

5656
When /^I delete the package$/ do
@@ -68,7 +68,7 @@
6868
end
6969

7070
Then /^I should get an error$/ do
71-
@last_error.should_not be_nil
71+
expect(@last_error).to_not be_nil
7272
end
7373

7474

@@ -78,70 +78,70 @@
7878
##
7979

8080
When /^I import a course$/ do
81-
@last_uploaded_file.should_not be_nil
81+
expect(@last_uploaded_file).to_not be_nil
8282
@last_course_id = "small_scorm_course_#{rand(1000)}"
8383
hash = @c.course.import_course(@last_course_id, @last_uploaded_path)
84-
hash.should_not be_nil
85-
hash[:title].should_not be_nil
84+
expect(hash).to_not be_nil
85+
expect(hash[:title]).to_not be_nil
8686
end
8787

8888
Given /^a registered course$/ do
89-
When "I import a course"
89+
step "I import a course"
9090
end
9191

9292
Then /^the course should be in the course list$/ do
93-
@c.course.get_course_list.find { |c| c.id == @last_course_id}.should_not be_nil
93+
expect(@c.course.get_course_list.find { |c| c.id == @last_course_id}).to_not be_nil
9494
end
9595

9696
Then /^there should be (\d+) courses? in the list$/ do |count|
97-
@c.course.get_course_list.size.should eq(count.to_i)
97+
expect(@c.course.get_course_list.size).to eq(count.to_i)
9898
end
9999

100100
When /^I delete the course$/ do
101-
@c.course.delete_course(@last_course_id).should eq(true)
101+
expect(@c.course.delete_course(@last_course_id)).to eq(true)
102102
end
103103

104104
Then /^the course should not be in the course list$/ do
105-
@c.course.get_course_list.find { |c| c.id == @last_course_id}.should be_nil
105+
expect(@c.course.get_course_list.find { |c| c.id == @last_course_id}).to be_nil
106106
end
107107

108108
Then /^I can get a preview URL for the course$/ do
109-
@c.course.preview(@last_course_id, "http://www.example.com").should match(/http:\/\/.+/)
109+
expect(@c.course.preview(@last_course_id, "http://www.example.com")).to match(/http:\/\/.+/)
110110
end
111111

112112
Then /^the course will have a properties url$/ do
113-
@c.course.properties(@last_course_id).should match(/http:\/\/.+/)
113+
expect(@c.course.properties(@last_course_id)).to match(/http:\/\/.+/)
114114
end
115115

116116
Then /^the course should exist$/ do
117-
@c.course.exists(@last_course_id).should be_true
117+
expect(@c.course.exists(@last_course_id)).to be(true)
118118
end
119119

120120
Then /^I can get the manifest for the course$/ do
121121
xml = @c.course.get_manifest(@last_course_id)
122122
doc = REXML::Document.new(xml)
123-
doc.elements["//manifest"].should_not be_nil
123+
expect(doc.elements["//manifest"]).to_not be_nil
124124
end
125125

126126
Then /^I can get the attributes for the course$/ do
127127
h = @c.course.get_attributes(@last_course_id)
128-
h.should be_kind_of(Hash)
129-
h[:showProgressBar].should eq("false")
130-
h[:showCourseStructure].should eq("false")
128+
expect(h).to be_kind_of(Hash)
129+
expect(h[:showProgressBar]).to eq("false")
130+
expect(h[:showCourseStructure]).to eq("false")
131131
end
132132

133133
When /^I update course attributes$/ do
134134
updated = @c.course.update_attributes(@last_course_id,
135135
{:desiredHeight => "700", :commCommitFrequency => "59999" })
136-
updated[:desiredHeight].should eq("700")
137-
updated[:commCommitFrequency].should eq("59999")
136+
expect(updated[:desiredHeight]).to eq("700")
137+
expect(updated[:commCommitFrequency]).to eq("59999")
138138
end
139139

140140
Then /^the course attributes should be updated$/ do
141141
h = @c.course.get_attributes(@last_course_id)
142-
h.should be_kind_of(Hash)
143-
h[:desiredHeight].should eq("700")
144-
h[:commCommitFrequency].should eq("59999")
142+
expect(h).to be_kind_of(Hash)
143+
expect(h[:desiredHeight]).to eq("700")
144+
expect(h[:commCommitFrequency]).to eq("59999")
145145
end
146146

147147

@@ -153,25 +153,25 @@
153153
@last_reg_id = "small_scorm_course_#{rand(1000)}"
154154
r = @c.registration.create_registration(@last_course_id, @last_reg_id,
155155
"fname", "lname", "lid", :email => "lid@example.com")
156-
r.should be_true
156+
expect(r).to be(true)
157157
end
158158

159159
Then /^the learner should be in the registration list$/ do
160160
list = @c.registration.get_registration_list
161-
list.find { |r| r.id == @last_reg_id }.should_not be_nil
161+
expect(list.find { |r| r.id == @last_reg_id }).to_not be_nil
162162
end
163163

164164
Then /^the learner should not be in the registration list$/ do
165165
list = @c.registration.get_registration_list
166-
list.find { |r| r.id == @last_reg_id }.should be_nil
166+
expect(list.find { |r| r.id == @last_reg_id }).to be_nil
167167
end
168168

169169
When /^I delete the registration$/ do
170-
@c.registration.delete_registration(@last_reg_id).should be_true
170+
expect(@c.registration.delete_registration(@last_reg_id)).to be(true)
171171
end
172172

173173
When /^I reset the registration$/ do
174-
@c.registration.reset_registration(@last_reg_id).should be_true
174+
expect(@c.registration.reset_registration(@last_reg_id)).to be(true)
175175
end
176176

177177
When /^I launch the course$/ do
@@ -180,5 +180,5 @@
180180

181181
Then /^I can get the registration results$/ do
182182
@reg_results = @c.registration.get_registration_result(@last_reg_id, "full")
183-
@reg_results.should include('<rsp stat="ok"><registrationreport')
183+
expect(@reg_results).to include('<rsp stat="ok"><registrationreport')
184184
end

features/support/env.rb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
## Cleanup before testing
1919
##
2020
Before do
21-
2221
# Grab a connection
2322
unless @c
2423
@c = ScormCloud::ScormCloud.new($scorm_cloud_appid,$scorm_cloud_secret)
@@ -28,10 +27,9 @@
2827
@c.course.get_course_list.each do |course|
2928
@c.course.delete_course(course.id)
3029
end
31-
@c.course.get_course_list.count.should eq(0)
30+
expect(@c.course.get_course_list.count).to eq(0)
3231

3332
unless @last_uploaded_file
34-
3533
# Cleanup all zip packages
3634
@c.upload.list_files.each do |file|
3735
@c.upload.delete_files(file[:file])
@@ -43,29 +41,23 @@
4341
path = File.join(File.dirname(__FILE__), '..', '..', 'spec', 'small_scorm_package.zip')
4442
@last_uploaded_path = @c.upload.upload_file(token, path)
4543
@last_uploaded_dir, @last_uploaded_file = @last_uploaded_path.split('/')
46-
@last_uploaded_file.should include('.zip')
44+
expect(@last_uploaded_file).to include('.zip')
4745

4846
sleep(5)
49-
5047
end
5148

5249
# was a course created?
53-
@c.course.get_course_list.count.should eq(0)
54-
@c.upload.list_files.count.should eq(1)
50+
expect(@c.course.get_course_list.count).to eq(0)
51+
expect(@c.upload.list_files.count).to eq(1)
5552

5653
@last_course_id = nil
5754
@last_error = nil
5855
@last_response = nil
59-
6056
end
6157

62-
6358
After do
64-
6559
# Cleanup all courses
6660
@c.course.get_course_list.each do |course|
6761
@c.course.delete_course(course.id)
6862
end
69-
7063
end
71-

spec/debug_service_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
it { should respond_to(:get_time).with(0).arguments }
99

1010
it "should ping the server" do
11-
subject.ping.should include("pong")
11+
expect(subject.ping).to include("pong")
1212
end
1313

1414
it "should auth_ping the server" do
15-
subject.auth_ping.should include("pong")
15+
expect(subject.auth_ping).to include("pong")
1616
end
1717

1818
it "should get the time" do
19-
subject.get_time.should match(/\d+/)
19+
expect(subject.get_time).to match(/\d+/)
2020
end
2121
end
2222
end

0 commit comments

Comments
 (0)