spec/csl/schema_spec.rb in csl-1.2.1 vs spec/csl/schema_spec.rb in csl-1.2.2
- old
+ new
@@ -2,107 +2,108 @@
module CSL
describe 'Schema' do
it 'cannot be instantiated' do
- Schema.should_not respond_to(:new)
+ expect(Schema).not_to respond_to(:new)
end
describe '.version' do
it 'returns a version string' do
- Schema.version.should match(/^\d+\.\d+\.\d+/)
+ expect(Schema.version).to match(/^\d+\.\d+\.\d+/)
end
it 'is greater than 1.0' do
- Schema.version.split(/\./)[0].to_i.should >= 1
+ expect(Schema.version.split(/\./)[0].to_i).to be >= 1
end
end
describe '.variables' do
it 'contains :names fields' do
- Schema.variables[:names].should_not be_empty
- Schema.variables[:name].should equal Schema.variables[:names]
+ expect(Schema.variables[:names]).not_to be_empty
+ expect(Schema.variables[:name]).to equal Schema.variables[:names]
end
it 'contains :date fields' do
- Schema.variables[:date].should_not be_empty
- Schema.variables[:dates].should equal Schema.variables[:date]
+ expect(Schema.variables[:date]).not_to be_empty
+ expect(Schema.variables[:dates]).to equal Schema.variables[:date]
end
it 'contains :text fields' do
- Schema.variables[:text].should_not be_empty
+ expect(Schema.variables[:text]).not_to be_empty
end
it 'contains :number fields' do
- Schema.variables[:numbers].should_not be_empty
- Schema.variables[:number].should_not be_empty
+ expect(Schema.variables[:numbers]).not_to be_empty
+ expect(Schema.variables[:number]).not_to be_empty
end
it 'accepts either string or symbol input' do
- Schema.variables[:names].should equal Schema.variables['names']
+ expect(Schema.variables[:names]).to equal Schema.variables['names']
end
end
describe '.types' do
it 'returns an array' do
- Schema.types.should be_a(Array)
+ expect(Schema.types).to be_a(Array)
end
it 'is not empty' do
- Schema.types.should_not be_empty
+ expect(Schema.types).not_to be_empty
end
it 'includes :article' do
- Schema.types.should include(:article)
+ expect(Schema.types).to include(:article)
end
end
describe '.categories' do
it 'given a field name returns the corresponding type' do
- Schema.categories.values_at(:author, :issued, :abstract, :issue).should ==
+ expect(Schema.categories.values_at(:author, :issued, :abstract, :issue)).to eq(
[:names, :date, :text, :number]
+ )
end
it 'accepts either string or symbol input' do
- Schema.categories.should have_key(:author)
- Schema.categories['author'].should equal Schema.categories[:author]
+ expect(Schema.categories).to have_key(:author)
+ expect(Schema.categories['author']).to equal Schema.categories[:author]
end
end
describe '.validate' do
it 'accepts and validates a locale instance' do
- Schema.validate(Locale.load('en-US')).should == []
+ expect(Schema.validate(Locale.load('en-US'))).to eq([])
end
it 'accepts and validates a locale file path' do
- Schema.validate(File.join(Locale.root, 'locales-en-US.xml')).should == []
+ expect(Schema.validate(File.join(Locale.root, 'locales-en-US.xml'))).to eq([])
end
it 'accepts and validates a locale file' do
- Schema.validate(File.open(File.join(Locale.root, 'locales-en-US.xml'))).should == []
+ expect(Schema.validate(File.open(File.join(Locale.root, 'locales-en-US.xml')))).to eq([])
end
it 'accepts and validates a locale wildcard path' do
- Schema.validate(File.join(Locale.root, 'locales-en-*.xml')).should == []
+ expect(Schema.validate(File.join(Locale.root, 'locales-en-*.xml'))).to eq([])
end
it 'accepts and validates a style file path' do
- Schema.validate(File.join(Style.root, 'apa.csl')).should == []
+ expect(Schema.validate(File.join(Style.root, 'apa.csl'))).to eq([])
end
it 'accepts and validates the xml contents of a style instance' do
- Schema.validate(Style.load(:apa).pretty_print).should == []
+ expect(Schema.validate(Style.load(:apa).pretty_print)).to eq([])
end
it 'accepts and validates a style instance' do
- Schema.validate(Style.load(:apa)).should == []
+ expect(Schema.validate(Style.load(:apa))).to eq([])
end
it 'does not accept invalid xml markup' do
- Schema.validate(%Q{
+ expect(Schema.validate(%Q{
<style xmlns="http://purl.org/net/xbiblio/csl" class="note" version="1.0">
</stle>
- })[0][0].should == 0 # error on line 0 -> parse error
+ })[0][0]).to eq(0) # error on line 0 -> parse error
end
# TODO fix nokogiri/jing validation
end unless RUBY_PLATFORM =~ /java/i