spec/citeproc/ruby/engine_spec.rb in citeproc-ruby-1.0.3 vs spec/citeproc/ruby/engine_spec.rb in citeproc-ruby-1.0.4

- old
+ new

@@ -8,25 +8,25 @@ describe 'The CiteProc-Ruby Engine' do let(:cp) { CiteProc::Processor.new :style => 'apa', :format => 'text' } let(:engine) { cp.engine } it 'registers itself as "citeproc-ruby"' do - CiteProc::Engine.available.should include('citeproc-ruby') + expect(CiteProc::Engine.available).to include('citeproc-ruby') end it 'is the default engine' do - CiteProc::Engine.default.should equal(CiteProc::Ruby::Engine) - engine.should be_a(CiteProc::Ruby::Engine) + expect(CiteProc::Engine.default).to equal(CiteProc::Ruby::Engine) + expect(engine).to be_a(CiteProc::Ruby::Engine) end describe '#bibliography' do describe 'when there are no items in the processor' do it 'returns an empty bibliography for any selector' do - cp.bibliography().should be_empty - cp.bibliography(:all => {}).should be_empty - cp.bibliography(:none => {}).should be_empty + expect(cp.bibliography()).to be_empty + expect(cp.bibliography(:all => {})).to be_empty + expect(cp.bibliography(:none => {})).to be_empty end end end @@ -41,28 +41,28 @@ cp << items(:knuth1968).data cp << items(:difference).data end it 'renders the reference for the given id' do - cp.render(:bibliography, :id => 'grammatology').should == ['Derrida, J. (1976). Of Grammatology (corrected ed.). Baltimore: Johns Hopkins University Press.'] - cp.render(:citation, :id => 'grammatology', :locator => '3-4').should == '(Derrida, 1976, pp. 3-4)' - cp.render(:bibliography, :id => 'knuth1968').should == ['Knuth, D. (1968). The art of computer programming (Vol. 1). Boston: Addison-Wesley.'] + expect(cp.render(:bibliography, :id => 'grammatology')).to eq(['Derrida, J. (1976). Of Grammatology (corrected ed.). Baltimore: Johns Hopkins University Press.']) + expect(cp.render(:citation, :id => 'grammatology', :locator => '3-4')).to eq('(Derrida, 1976, pp. 3-4)') + expect(cp.render(:bibliography, :id => 'knuth1968')).to eq(['Knuth, D. (1968). The art of computer programming (Vol. 1). Boston: Addison-Wesley.']) node = cp.engine.style.macros['author'] (node > 'names' > 'name')[:initialize] = 'false' cp.engine.format = 'html' - cp.render(:bibliography, :id => 'knuth1968').should == ['Knuth, Donald. (1968). <i>The art of computer programming</i> (Vol. 1). Boston: Addison-Wesley.'] + expect(cp.render(:bibliography, :id => 'knuth1968')).to eq(['Knuth, Donald. (1968). <i>The art of computer programming</i> (Vol. 1). Boston: Addison-Wesley.']) - cp.render(:citation, :id => 'knuth1968', :locator => '23').should == '(Knuth, 1968, p. 23)' + expect(cp.render(:citation, :id => 'knuth1968', :locator => '23')).to eq('(Knuth, 1968, p. 23)') end it 'overrides locales if the processor option is set' do - cp.render(:bibliography, :id => 'difference').should == ['Derrida, J. (1967). L’écriture et la différence (1st ed.). Paris: Éditions du Seuil.'] + expect(cp.render(:bibliography, :id => 'difference')).to eq(['Derrida, J. (1967). L’écriture et la différence (1st ed.). Paris: Éditions du Seuil.']) cp.options[:allow_locale_overrides] = true - cp.render(:bibliography, :id => 'difference').should == ['Derrida, J. (1967). L’écriture et la différence (1ʳᵉ éd.). Paris: Éditions du Seuil.'] + expect(cp.render(:bibliography, :id => 'difference')).to eq(['Derrida, J. (1967). L’écriture et la différence (1ʳᵉ éd.). Paris: Éditions du Seuil.']) end end end describe '#process' do @@ -74,17 +74,17 @@ cp << items(:grammatology).data cp << items(:knuth1968).data end it 'renders the citation for the given id' do - cp.process(:id => 'knuth1968', :locator => '23').should == '(Knuth, 1968, p. 23)' + expect(cp.process(:id => 'knuth1968', :locator => '23')).to eq('(Knuth, 1968, p. 23)') end it 'combines and sorts multiple cite items' do - cp.process([ + expect(cp.process([ {:id => 'knuth1968', :locator => '23'}, {:id => 'grammatology', :locator => '11-14'} - ]).should == '(Derrida, 1976, pp. 11-14; Knuth, 1968, p. 23)' + ])).to eq('(Derrida, 1976, pp. 11-14; Knuth, 1968, p. 23)') end end end end