-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from rubychan/extend-specs
Add Specs
- Loading branch information
Showing
5 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ rvm: | |
- 2.4 | ||
- 2.5 | ||
- 2.6 | ||
- 2.7 | ||
- ruby-head | ||
- jruby | ||
matrix: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
require File.expand_path('../spec_helper', __FILE__) | ||
|
||
RSpec.describe CodeRay do | ||
describe 'version' do | ||
describe '::VERSION' do | ||
it "returns the Gem's version" do | ||
expect(CodeRay::VERSION).to match(/\A\d\.\d\.\d?\z/) | ||
end | ||
end | ||
|
||
describe '.coderay_path' do | ||
it 'returns an absolute file path to the given code file' do | ||
base = File.expand_path('../..', __FILE__) | ||
expect(CodeRay.coderay_path('file')).to eq("#{base}/lib/coderay/file") | ||
end | ||
end | ||
|
||
describe '.scan' do | ||
let(:code) { 'puts "Hello, World!"' } | ||
let(:tokens) do | ||
[ | ||
['puts', :ident], | ||
[' ', :space], | ||
[:begin_group, :string], | ||
['"', :delimiter], | ||
['Hello, World!', :content], | ||
['"', :delimiter], | ||
[:end_group, :string] | ||
].flatten | ||
end | ||
|
||
it 'returns tokens' do | ||
expect(CodeRay.scan(code, :ruby).tokens).to eq(tokens) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters