citeproc 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,8 @@ module CiteProc
9
9
 
10
10
  it { should_not be nil }
11
11
 
12
- it { p.engine.should_not be nil }
13
- it { p.engine.name.should == 'citeproc-ruby' }
12
+ it { expect(p.engine).not_to be nil }
13
+ it { expect(p.engine.name).to eq('citeproc-ruby') }
14
14
 
15
15
  describe '#register' do
16
16
 
@@ -31,7 +31,7 @@ module CiteProc
31
31
  end
32
32
 
33
33
  it 'returns the processor' do
34
- (p << palefire).should be_equal(p)
34
+ expect(p << palefire).to be_equal(p)
35
35
  end
36
36
 
37
37
  end
@@ -40,7 +40,7 @@ module CiteProc
40
40
 
41
41
  describe 'when there is no item with the passed-in id' do
42
42
  it 'returns nil' do
43
- p[:palefire].should be nil
43
+ expect(p[:palefire]).to be nil
44
44
  end
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ module CiteProc
48
48
  before(:each) { p.register(palefire) }
49
49
 
50
50
  it 'returns the item' do
51
- p[:palefire].should equal(palefire)
51
+ expect(p[:palefire]).to equal(palefire)
52
52
  end
53
53
  end
54
54
  end
@@ -65,11 +65,11 @@ module CiteProc
65
65
 
66
66
  describe 'when passed a hash' do
67
67
  it 'registers the value with the key as id' do
68
- p.update(:foo => palefire)[:foo].should equal(palefire)
68
+ expect(p.update(:foo => palefire)[:foo]).to equal(palefire)
69
69
  end
70
70
 
71
71
  it 'converts the value to an item' do
72
- p.update(:foo => { :title => 'The Story of Foo' })[:foo].should be_a(Item)
72
+ expect(p.update(:foo => { :title => 'The Story of Foo' })[:foo]).to be_a(Item)
73
73
  end
74
74
  end
75
75
 
@@ -88,7 +88,7 @@ module CiteProc
88
88
  describe 'when no items have been processed' do
89
89
 
90
90
  it 'returns an empty bibliography' do
91
- p.bibliography.should be_empty
91
+ expect(p.bibliography).to be_empty
92
92
  end
93
93
 
94
94
  # it 'returns a bibliography of all registered items if invoked with :all'
@@ -11,24 +11,24 @@ module CiteProc
11
11
 
12
12
 
13
13
  it 'should have no skip_condtions by default' do
14
- Selector.new.skip_conditions.should be_empty
14
+ expect(Selector.new.skip_conditions).to be_empty
15
15
  end
16
16
 
17
17
  it 'should have no condtions by default' do
18
- Selector.new.conditions.should be_empty
18
+ expect(Selector.new.conditions).to be_empty
19
19
  end
20
20
 
21
21
  describe 'constructing' do
22
22
 
23
23
  %w{ all none any skip }.each do |matcher|
24
24
  it "accepts the ruby style matcher '#{matcher}'" do
25
- Selector.new(matcher => {}).should_not be nil
25
+ expect(Selector.new(matcher => {})).not_to be nil
26
26
  end
27
27
  end
28
28
 
29
29
  %w{ include exclude select quash }.each do |matcher|
30
30
  it "accepts the citeproc-js style matcher '#{matcher}'" do
31
- Selector.new(matcher => {}).should_not be nil
31
+ expect(Selector.new(matcher => {})).not_to be nil
32
32
  end
33
33
  end
34
34
 
@@ -38,7 +38,7 @@ module CiteProc
38
38
  # it 'accepts a citeproc json style hash'
39
39
 
40
40
  it 'accepts a json object (select)' do
41
- Selector.new(
41
+ expect(Selector.new(
42
42
  "select" => [
43
43
  {
44
44
  "field" => "type",
@@ -48,7 +48,7 @@ module CiteProc
48
48
  "value" => "1990s"
49
49
  }
50
50
  ]
51
- ).conditions.should have(2).items
51
+ ).conditions.size).to eq(2)
52
52
  end
53
53
  end
54
54
 
@@ -58,31 +58,31 @@ module CiteProc
58
58
  describe '#to_citeproc' do
59
59
 
60
60
  it 'returns nil by default' do
61
- Selector.new.to_citeproc.should be nil
61
+ expect(Selector.new.to_citeproc).to be nil
62
62
  end
63
63
 
64
64
  it 'converts all matcher to select' do
65
- Selector.new(:all => { :a => 'b' }).to_citeproc.should == { 'select' => [{ 'field' => 'a', 'value' => 'b' }]}
65
+ expect(Selector.new(:all => { :a => 'b' }).to_citeproc).to eq({ 'select' => [{ 'field' => 'a', 'value' => 'b' }]})
66
66
  end
67
67
 
68
68
  it 'converts any matcher to include' do
69
- Selector.new(:any => { :a => 'b' }).to_citeproc.should == { 'include' => [{ 'field' => 'a', 'value' => 'b' }]}
69
+ expect(Selector.new(:any => { :a => 'b' }).to_citeproc).to eq({ 'include' => [{ 'field' => 'a', 'value' => 'b' }]})
70
70
  end
71
71
 
72
72
  it 'converts none matcher to exclude' do
73
- Selector.new(:none => { :a => 'b' }).to_citeproc.should == { 'exclude' => [{ 'field' => 'a', 'value' => 'b' }]}
73
+ expect(Selector.new(:none => { :a => 'b' }).to_citeproc).to eq({ 'exclude' => [{ 'field' => 'a', 'value' => 'b' }]})
74
74
  end
75
75
  end
76
76
 
77
77
  describe '#matches?' do
78
78
  it 'always matches by default' do
79
- Selector.new.matches?(nil).should be_true
79
+ expect(Selector.new.matches?(nil)).to be_true
80
80
  end
81
81
  end
82
82
 
83
83
  describe '#skip?' do
84
84
  it 'never skips when by default' do
85
- Selector.new.skip?(nil).should be_false
85
+ expect(Selector.new.skip?(nil)).to be_false
86
86
  end
87
87
  end
88
88
  end
@@ -4,7 +4,7 @@ describe 'CiteProc' do
4
4
 
5
5
  describe '.process' do
6
6
  it 'is defined' do
7
- CiteProc.should respond_to(:process)
7
+ expect(CiteProc).to respond_to(:process)
8
8
  end
9
9
  end
10
10
 
@@ -7,159 +7,159 @@ module CiteProc
7
7
  it { should be_an_instance_of(Variable) }
8
8
 
9
9
  it 'is empty by default' do
10
- Variable.new.should be_empty
10
+ expect(Variable.new).to be_empty
11
11
  end
12
12
 
13
13
  it 'equals an empty string (==) by default' do
14
- Variable.new.should == ''
14
+ expect(Variable.new).to eq('')
15
15
  end
16
16
 
17
17
  it 'matches an empty pattern by default' do
18
- Variable.new.should =~ /^$/
18
+ expect(Variable.new).to match(/^$/)
19
19
  end
20
20
 
21
21
  it 'accepts a string value' do
22
- Variable.new('test').should == 'test'
22
+ expect(Variable.new('test')).to eq('test')
23
23
  end
24
24
 
25
25
  it 'accepts a numeric value' do
26
- Variable.new(23).should == '23'
26
+ expect(Variable.new(23)).to eq('23')
27
27
  end
28
28
 
29
29
  it 'accepts a floating point value' do
30
- Variable.new(23.12).should == '23.12'
30
+ expect(Variable.new(23.12)).to eq('23.12')
31
31
  end
32
32
  end
33
33
 
34
34
  describe '.fields' do
35
35
  it 'contains :names fields' do
36
- Variable.fields[:names].should_not be_empty
37
- Variable.fields[:name].should equal Variable.fields[:names]
36
+ expect(Variable.fields[:names]).not_to be_empty
37
+ expect(Variable.fields[:name]).to equal Variable.fields[:names]
38
38
  end
39
39
 
40
40
  it 'contains :date fields' do
41
- Variable.fields[:date].should_not be_empty
42
- Variable.fields[:dates].should equal Variable.fields[:date]
41
+ expect(Variable.fields[:date]).not_to be_empty
42
+ expect(Variable.fields[:dates]).to equal Variable.fields[:date]
43
43
  end
44
44
 
45
45
  it 'contains :text fields' do
46
- Variable.fields[:text].should_not be_empty
46
+ expect(Variable.fields[:text]).not_to be_empty
47
47
  end
48
48
 
49
49
  it 'contains :number fields' do
50
- Variable.fields[:numbers].should_not be_empty
51
- Variable.fields[:number].should_not be_empty
50
+ expect(Variable.fields[:numbers]).not_to be_empty
51
+ expect(Variable.fields[:number]).not_to be_empty
52
52
  end
53
53
 
54
54
  it 'accepts either string or symbol input' do
55
- Variable.fields[:names].should equal Variable.fields['names']
55
+ expect(Variable.fields[:names]).to equal Variable.fields['names']
56
56
  end
57
57
  end
58
58
 
59
59
  describe '.types' do
60
60
  it 'given a field name returns the corresponding type' do
61
- Variable.types.values_at(:author, :issued, :abstract, :issue).should == [:names, :date, :text, :number]
61
+ expect(Variable.types.values_at(:author, :issued, :abstract, :issue)).to eq([:names, :date, :text, :number])
62
62
  end
63
63
 
64
64
  it 'accepts either string or symbol input' do
65
- Variable.types.should have_key(:author)
66
- Variable.types['author'].should equal Variable.types[:author]
65
+ expect(Variable.types).to have_key(:author)
66
+ expect(Variable.types['author']).to equal Variable.types[:author]
67
67
  end
68
68
  end
69
69
 
70
70
  describe '#to_s' do
71
71
  it 'displays the value' do
72
- Variable.new('test').to_s.should == 'test'
72
+ expect(Variable.new('test').to_s).to eq('test')
73
73
  end
74
74
  end
75
75
 
76
76
  describe '#to_i' do
77
77
  it 'returns zero by default' do
78
- Variable.new.to_i.should == 0
78
+ expect(Variable.new.to_i).to eq(0)
79
79
  end
80
80
 
81
81
  context 'when the value is numeric' do
82
82
  %w{ -23 -1 0 1 23 }.each do |value|
83
83
  it "returns the integer value (#{value})" do
84
- Variable.new(value).to_i.should equal(value.to_i)
84
+ expect(Variable.new(value).to_i).to equal(value.to_i)
85
85
  end
86
86
  end
87
87
 
88
88
  it 'returns only the first numeric value if there are several' do
89
- Variable.new('testing 1, 2, 3...').to_i.should == 1
89
+ expect(Variable.new('testing 1, 2, 3...').to_i).to eq(1)
90
90
  end
91
91
  end
92
92
  end
93
93
 
94
94
  describe '#to_f' do
95
95
  it 'returns zero by default' do
96
- Variable.new.to_f.should == 0.0
96
+ expect(Variable.new.to_f).to eq(0.0)
97
97
  end
98
98
 
99
99
  context 'when the value is numeric' do
100
100
  %w{ -23.2 -1.45 0.2 1.733 23 }.each do |value|
101
101
  it "returns the integer value (#{value})" do
102
- Variable.new(value).to_f.should == value.to_f
102
+ expect(Variable.new(value).to_f).to eq(value.to_f)
103
103
  end
104
104
  end
105
105
 
106
106
  it 'returns only the first numeric value if there are several' do
107
- Variable.new('testing 1, 2, 3...').to_f.should == 1.0
107
+ expect(Variable.new('testing 1, 2, 3...').to_f).to eq(1.0)
108
108
  end
109
109
 
110
110
  it 'works with dot and comma separators' do
111
- Variable.new('1,23').to_f.should == Variable.new('1.23').to_f
111
+ expect(Variable.new('1,23').to_f).to eq(Variable.new('1.23').to_f)
112
112
  end
113
113
  end
114
114
  end
115
115
 
116
116
  describe '#numeric?' do
117
117
  it 'returns false by default' do
118
- Variable.new.should_not be_numeric
118
+ expect(Variable.new).not_to be_numeric
119
119
  end
120
120
 
121
121
  context 'variable contains a number' do
122
122
  it 'returns true (string initialized)' do
123
- Variable.new('23').should be_numeric
124
- Variable.new('X23').should be_numeric
125
- Variable.new('23rd').should be_numeric
123
+ expect(Variable.new('23')).to be_numeric
124
+ expect(Variable.new('X23')).to be_numeric
125
+ expect(Variable.new('23rd')).to be_numeric
126
126
  end
127
127
  it 'returns true (integer initialized)' do
128
- Variable.new(23).should be_numeric
128
+ expect(Variable.new(23)).to be_numeric
129
129
  end
130
130
  end
131
131
 
132
132
  context 'variable does not contain a number' do
133
133
  it 'returns false for strings' do
134
- Variable.new('test').should_not be_numeric
134
+ expect(Variable.new('test')).not_to be_numeric
135
135
  end
136
136
  end
137
137
 
138
138
  context 'variable contains numbers but is not numeric' do
139
139
  it 'returns false for strings' do
140
- Variable.new('23rd test').should_not be_numeric
141
- Variable.new('23rd, 24th & 25th edition').should_not be_numeric
140
+ expect(Variable.new('23rd test')).not_to be_numeric
141
+ expect(Variable.new('23rd, 24th & 25th edition')).not_to be_numeric
142
142
  end
143
143
  end
144
144
 
145
145
  context 'variable contains multiple numbers' do
146
146
  it 'returns true for simple ranges' do
147
- Variable.new('23-24').should be_numeric
148
- Variable.new('23 - 24').should be_numeric
149
- Variable.new('23- 24').should be_numeric
147
+ expect(Variable.new('23-24')).to be_numeric
148
+ expect(Variable.new('23 - 24')).to be_numeric
149
+ expect(Variable.new('23- 24')).to be_numeric
150
150
  end
151
151
 
152
152
  it 'returns true for simple lists' do
153
- Variable.new('23,24').should be_numeric
154
- Variable.new('23 , 24').should be_numeric
155
- Variable.new('23, 24').should be_numeric
156
- Variable.new('23 ,24').should be_numeric
157
- Variable.new('23 ,24,25 , 26, 27').should be_numeric
153
+ expect(Variable.new('23,24')).to be_numeric
154
+ expect(Variable.new('23 , 24')).to be_numeric
155
+ expect(Variable.new('23, 24')).to be_numeric
156
+ expect(Variable.new('23 ,24')).to be_numeric
157
+ expect(Variable.new('23 ,24,25 , 26, 27')).to be_numeric
158
158
  end
159
159
 
160
160
  it 'returns true for complex lists' do
161
- Variable.new('23rd, 24th & 25th').should be_numeric
162
- Variable.new('X23, A2-49th & 25th & A1, B2').should be_numeric
161
+ expect(Variable.new('23rd, 24th & 25th')).to be_numeric
162
+ expect(Variable.new('X23, A2-49th & 25th & A1, B2')).to be_numeric
163
163
  end
164
164
  end
165
165
  end
@@ -167,12 +167,12 @@ module CiteProc
167
167
  describe '#strip_markup' do
168
168
  let(:greeting) { '<h1>hello<b> world</b></h1>' }
169
169
  it 'returns a string stripped of html tags' do
170
- Variable.new(greeting).strip_markup.should == 'hello world'
170
+ expect(Variable.new(greeting).strip_markup).to eq('hello world')
171
171
  end
172
172
  it 'does not alter the value itself' do
173
173
  v = Variable.new(greeting)
174
174
  v.strip_markup
175
- v.should == greeting
175
+ expect(v).to eq(greeting)
176
176
  end
177
177
  end
178
178
 
@@ -181,7 +181,7 @@ module CiteProc
181
181
  it 'strips of html tags' do
182
182
  v = Variable.new(greeting)
183
183
  v.strip_markup!
184
- v.should == 'hello world'
184
+ expect(v).to eq('hello world')
185
185
  end
186
186
  end
187
187
 
@@ -12,14 +12,15 @@ begin
12
12
  # Debugger.start
13
13
  when defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
14
14
  require 'rubinius/debugger'
15
- else
15
+ when RUBY_VERSION < '2.0'
16
16
  require 'debugger'
17
+ else
18
+ require 'byebug'
17
19
  end
18
20
  rescue LoadError
19
21
  # ignore
20
22
  end
21
23
 
22
-
23
24
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
24
25
  $:.unshift(File.dirname(__FILE__))
25
26
 
@@ -9,9 +9,6 @@ module CSL
9
9
  quotes_PunctuationWithInnerQuote # replaces single quotes and apostrophes
10
10
  sort_SubstituteTitle # ---
11
11
  substitute_SuppressOrdinaryVariable # citeproc-js bug?
12
- sort_VariousNameMacros1 # ---
13
- sort_VariousNameMacros2 # ---
14
- sort_VariousNameMacros3 # ---
15
12
  sort_FamilyOnly # invalid CSL (no layout) / ANZ after Aardvark?
16
13
  name_ParticleCaps3 # " in family name
17
14
  testers_SecondAutoGeneratedZoteroPluginTest # uses <sc> for small-caps
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citeproc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2015-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: namae
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.8'
27
27
  description: "\n A cite processor interface for Citation Style Language (CSL) styles.\n
@@ -32,10 +32,10 @@ executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - .document
36
- - .rspec
37
- - .simplecov
38
- - .yardopts
35
+ - ".document"
36
+ - ".rspec"
37
+ - ".simplecov"
38
+ - ".yardopts"
39
39
  - AGPL
40
40
  - BSDL
41
41
  - Gemfile
@@ -91,17 +91,17 @@ require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.9.3
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - '>='
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
103
  rubyforge_project:
104
- rubygems_version: 2.2.2
104
+ rubygems_version: 2.4.5
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: A cite processor interface.