I have a table called Courses with two columns dept_code
and course_code
that are both strings.
I am writing my specs and I want to call the following module so I can use the valid_course_attributes
method to assign attributes to @course
.
module CoursesSpecHelper
def valid_course_attributes
{
:dept_code => 'HIST',
:course_code => '1010'
}
end
end
The module is called as such:
describe Courses do
require CoursesSpecHelper
before(:each) do
@course = Courses.new
end
it "should require dept_code" do
@course.attributes = valid_course_attributes.except(:dept_code)
@course.should have(1).error_on(:dept_code)
end
end
When I run my examples, I keep getting the following error:
TypeError: can't convert Module into String
I have tried a couple of variations, but I cannot figure out what this problem means.
Thanks so much!
我想你要
include CoursesSpecHelper
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.