|
2 | 2 | ## Generic |
3 | 3 | ## |
4 | 4 | Then /^I will get a valid url$/ do |
5 | | - @last_url.should match(/http\:\/\/.+/) |
| 5 | + expect(@last_url).to match(/http\:\/\/.+/) |
6 | 6 | end |
7 | 7 |
|
8 | 8 |
|
|
23 | 23 | end |
24 | 24 |
|
25 | 25 | Then /^the response should be "([^"]*)"$/ do |arg1| #" |
26 | | - @last_response.should eq(arg1) |
| 26 | + expect(@last_response).to eq(arg1) |
27 | 27 | end |
28 | 28 |
|
29 | 29 | Then /^the resonse should be the current time$/ do |
30 | | - @last_response.should match(/\d+/) |
| 30 | + expect(@last_response).to match(/\d+/) |
31 | 31 | end |
32 | 32 |
|
33 | 33 | ## |
|
36 | 36 |
|
37 | 37 | When /^I upload a package$/ do |
38 | 38 | token = @c.upload.get_upload_token |
39 | | - token.should_not be_nil |
| 39 | + expect(token).to_not be_nil |
40 | 40 | path = File.join(File.dirname(__FILE__), '..', '..', 'spec', 'small_scorm_package.zip') |
41 | 41 | @last_upload_path = @c.upload.upload_file(token, path) |
42 | 42 | @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') |
44 | 44 | end |
45 | 45 |
|
46 | 46 | Then /^the package files should be available$/ do |
47 | 47 | list = @c.upload.list_files.map { |f| f[:file] } |
48 | | - list.should include(@last_uploaded_file) |
| 48 | + expect(list).to include(@last_uploaded_file) |
49 | 49 | end |
50 | 50 |
|
51 | 51 | Then /^the package files should not be available$/ do |
52 | 52 | 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) |
54 | 54 | end |
55 | 55 |
|
56 | 56 | When /^I delete the package$/ do |
|
68 | 68 | end |
69 | 69 |
|
70 | 70 | Then /^I should get an error$/ do |
71 | | - @last_error.should_not be_nil |
| 71 | + expect(@last_error).to_not be_nil |
72 | 72 | end |
73 | 73 |
|
74 | 74 |
|
|
78 | 78 | ## |
79 | 79 |
|
80 | 80 | When /^I import a course$/ do |
81 | | - @last_uploaded_file.should_not be_nil |
| 81 | + expect(@last_uploaded_file).to_not be_nil |
82 | 82 | @last_course_id = "small_scorm_course_#{rand(1000)}" |
83 | 83 | 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 |
86 | 86 | end |
87 | 87 |
|
88 | 88 | Given /^a registered course$/ do |
89 | | - When "I import a course" |
| 89 | + step "I import a course" |
90 | 90 | end |
91 | 91 |
|
92 | 92 | 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 |
94 | 94 | end |
95 | 95 |
|
96 | 96 | 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) |
98 | 98 | end |
99 | 99 |
|
100 | 100 | 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) |
102 | 102 | end |
103 | 103 |
|
104 | 104 | 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 |
106 | 106 | end |
107 | 107 |
|
108 | 108 | 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:\/\/.+/) |
110 | 110 | end |
111 | 111 |
|
112 | 112 | 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:\/\/.+/) |
114 | 114 | end |
115 | 115 |
|
116 | 116 | 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) |
118 | 118 | end |
119 | 119 |
|
120 | 120 | Then /^I can get the manifest for the course$/ do |
121 | 121 | xml = @c.course.get_manifest(@last_course_id) |
122 | 122 | doc = REXML::Document.new(xml) |
123 | | - doc.elements["//manifest"].should_not be_nil |
| 123 | + expect(doc.elements["//manifest"]).to_not be_nil |
124 | 124 | end |
125 | 125 |
|
126 | 126 | Then /^I can get the attributes for the course$/ do |
127 | 127 | 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") |
131 | 131 | end |
132 | 132 |
|
133 | 133 | When /^I update course attributes$/ do |
134 | 134 | updated = @c.course.update_attributes(@last_course_id, |
135 | 135 | {: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") |
138 | 138 | end |
139 | 139 |
|
140 | 140 | Then /^the course attributes should be updated$/ do |
141 | 141 | 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") |
145 | 145 | end |
146 | 146 |
|
147 | 147 |
|
|
153 | 153 | @last_reg_id = "small_scorm_course_#{rand(1000)}" |
154 | 154 | r = @c.registration.create_registration(@last_course_id, @last_reg_id, |
155 | 155 | "fname", "lname", "lid", :email => "lid@example.com") |
156 | | - r.should be_true |
| 156 | + expect(r).to be(true) |
157 | 157 | end |
158 | 158 |
|
159 | 159 | Then /^the learner should be in the registration list$/ do |
160 | 160 | 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 |
162 | 162 | end |
163 | 163 |
|
164 | 164 | Then /^the learner should not be in the registration list$/ do |
165 | 165 | 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 |
167 | 167 | end |
168 | 168 |
|
169 | 169 | 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) |
171 | 171 | end |
172 | 172 |
|
173 | 173 | 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) |
175 | 175 | end |
176 | 176 |
|
177 | 177 | When /^I launch the course$/ do |
|
180 | 180 |
|
181 | 181 | Then /^I can get the registration results$/ do |
182 | 182 | @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') |
184 | 184 | end |
0 commit comments