Last change
on this file since 419 was 419, checked in by KOBAYASHI, Shinji, 14 years ago |
implementing openEHR terminology server
|
File size:
1.2 KB
|
Line | |
---|
1 | require 'spec_helper'
|
---|
2 |
|
---|
3 | describe Language do
|
---|
4 | fixtures :languages
|
---|
5 |
|
---|
6 | before(:each) do
|
---|
7 | @valid_attributes = {
|
---|
8 | :code => "jp",
|
---|
9 | :description => "Japan"
|
---|
10 | }
|
---|
11 | end
|
---|
12 |
|
---|
13 | it "should create a new instance given valid attributes" do
|
---|
14 | Language.create!(@valid_attributes)
|
---|
15 | end
|
---|
16 |
|
---|
17 | it 'should not valid when code is not assigned' do
|
---|
18 | Language.new(:description => 'Japan').should_not be_valid
|
---|
19 | end
|
---|
20 |
|
---|
21 | it 'should not valid when description is not assigned' do
|
---|
22 | Language.new(:code => 'jp').should_not be_valid
|
---|
23 | end
|
---|
24 |
|
---|
25 | it 'should return valid description for code' do
|
---|
26 | Language.find_by_code('af').
|
---|
27 | description.should == 'Afrikaans'
|
---|
28 | end
|
---|
29 |
|
---|
30 | it 'should have only one entry for one code' do
|
---|
31 | Language.find(:all, :conditions => ["code = ?", 'af']).size.
|
---|
32 | should be_equal 1
|
---|
33 | end
|
---|
34 |
|
---|
35 | it 'should return valid code for description' do
|
---|
36 | Language.first("description = ?", 'Albanian').code.should == 'sq'
|
---|
37 | end
|
---|
38 |
|
---|
39 | it 'should return valid description by code' do
|
---|
40 | Language.get_desc('af').should == 'Afrikaans'
|
---|
41 | end
|
---|
42 |
|
---|
43 | it 'should return true if code is on table' do
|
---|
44 | Language.should have_code 'af'
|
---|
45 | end
|
---|
46 |
|
---|
47 | it 'should return false if code is not on table' do
|
---|
48 | Language.should_not have_code 'eq'
|
---|
49 | end
|
---|
50 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.