spec/citeproc/ruby/renderer/label_spec.rb in citeproc-ruby-1.0.3 vs spec/citeproc/ruby/renderer/label_spec.rb in citeproc-ruby-1.0.4

- old
+ new

@@ -14,16 +14,16 @@ i } describe 'given an empty node' do it 'returns an empty string for an empty item' do - renderer.render_label(item, node).should == '' + expect(renderer.render_label(item, node)).to eq('') end it 'returns an empty string for an item with variables' do item.data.edition = 'foo' - renderer.render_label(item, node).should == '' + expect(renderer.render_label(item, node)).to eq('') end end # page @@ -31,72 +31,72 @@ describe "when the node's variable is set to :page" do before(:each) { node[:variable] = :page } describe "for an item with no page value" do it 'returns an empty string' do - renderer.render_label(item, node).should == '' + expect(renderer.render_label(item, node)).to eq('') end end describe 'for an item with a page value' do it 'returns the singular label for a number' do item.write_attribute :page, '23' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for a page-range' do item.write_attribute :page, '23-24' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end it 'returns the plural label for multiple pages' do item.write_attribute :page, '23 & 24' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') item.write_attribute :page, '23, 24, 25' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end describe 'when pluralization is contextual' do before(:each) { node[:plural] = 'contextual' } it 'returns the singular label for a number' do item.write_attribute :page, '23' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for a page-range' do item.write_attribute :page, '23-24' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end end describe 'when pluralization is set to "always"' do before(:each) { node[:plural] = 'always' } it 'returns the singular label for a number' do item.write_attribute :page, '1' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end it 'returns the plural label for a page-range' do item.write_attribute :page, '1-3' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end end describe 'when pluralization is set to "never"' do before(:each) { node[:plural] = 'never' } it 'returns the singular label for a number' do item.write_attribute :page, '1' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for a page-range' do item.write_attribute :page, '1-3' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end end end end @@ -106,76 +106,76 @@ describe "when the node's variable is set to :'number-of-pages'" do before(:each) { node[:variable] = 'number-of-pages' } describe "for an item with no 'number-of-pages' value" do it 'returns an empty string' do - renderer.render_label(item, node).should == '' + expect(renderer.render_label(item, node)).to eq('') end end describe "for an item with a 'number-of-pages' value" do it 'returns the singular label for number 1' do item.data[:'number-of-pages'] = 1 - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for numbers higher than 1' do item.data[:'number-of-pages'] = '2' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') item.data[:'number-of-pages'] = 42 - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end describe 'when pluralization is set to "contextual"' do before(:each) { node[:plural] = 'contextual' } it 'returns the singular label for number 1' do item.data[:'number-of-pages'] = '1' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for numbers higher than 1' do item.data[:'number-of-pages'] = '2' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') item.data[:'number-of-pages'] = 42 - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end end describe 'when pluralization is set to "always"' do before(:each) { node[:plural] = 'always' } it 'returns the singular label for number 1' do item.data[:'number-of-pages'] = 1 - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end it 'returns the plural label for numbers higher than 1' do item.data[:'number-of-pages'] = '2' - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') item.data[:'number-of-pages'] = 42 - renderer.render_label(item, node).should == 'pages' + expect(renderer.render_label(item, node)).to eq('pages') end end describe 'when pluralization is set to "never"' do before(:each) { node[:plural] = 'never' } it 'returns the singular label for number 1' do item.data[:'number-of-pages'] = 1 - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end it 'returns the plural label for numbers higher than 1' do item.data[:'number-of-pages'] = '2' - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') item.data[:'number-of-pages'] = 42 - renderer.render_label(item, node).should == 'page' + expect(renderer.render_label(item, node)).to eq('page') end end end end @@ -185,19 +185,19 @@ before(:each) { node[:variable] = 'number-of-volumes' } describe "for an item with a 'number-of-volumes' value" do it 'returns the singular label for number 1' do item.data[:'number-of-volumes'] = 1 - renderer.render_label(item, node).should == 'volume' + expect(renderer.render_label(item, node)).to eq('volume') end it 'returns the plural label for numbers higher than 1' do item.data[:'number-of-volumes'] = '2' - renderer.render_label(item, node).should == 'volumes' + expect(renderer.render_label(item, node)).to eq('volumes') item.data[:'number-of-volumes'] = 42 - renderer.render_label(item, node).should == 'volumes' + expect(renderer.render_label(item, node)).to eq('volumes') end end end # locators @@ -207,16 +207,16 @@ describe "for an item with a locator and label" do it "returns the singular label for a single number" do item.locator = 2 item.label = 'book' - renderer.render_label(item, node).should == 'book' + expect(renderer.render_label(item, node)).to eq('book') end it "returns the plural label for multiple numbers" do item.locator = '23 & 4' item.label = 'book' - renderer.render_label(item, node).should == 'books' + expect(renderer.render_label(item, node)).to eq('books') end end end end # render_label