-
Notifications
You must be signed in to change notification settings - Fork 1
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 #3 from aprescott/spec-changes
Restructure specs and move to RSpec 3
- Loading branch information
Showing
13 changed files
with
76 additions
and
31 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/Gemfile.lock |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
--color |
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,11 +1,8 @@ | ||
require "rake" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:test) do |t| | ||
t.rspec_opts = "-I test --color --format nested" | ||
t.pattern = "test/**/*_spec.rb" | ||
t.verbose = false | ||
t.fail_on_error = true | ||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
t.pattern = ["spec/**/*_spec.rb"] | ||
end | ||
|
||
task :default => :test | ||
task :default => :spec |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require "tempfile" | ||
|
||
require "vcdiff" | ||
|
||
RSpec.configure do |config| | ||
config.raise_errors_for_deprecations! | ||
|
||
# rspec-expectations config goes here. You can use an alternate | ||
# assertion/expectation library such as wrong or the stdlib/minitest | ||
# assertions if you prefer. | ||
config.expect_with :rspec do |expectations| | ||
expectations.syntax = :expect | ||
end | ||
|
||
# rspec-mocks config goes here. You can use an alternate test double | ||
# library (such as bogus or mocha) by changing the `mock_with` option here. | ||
config.mock_with :rspec do |mocks| | ||
# Enable only the newer, non-monkey-patching expect syntax. | ||
# For more details, see: | ||
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ | ||
mocks.syntax = :expect | ||
|
||
# Prevents you from mocking or stubbing a method that does not exist on | ||
# a real object. This is generally recommended. | ||
mocks.verify_partial_doubles = true | ||
end | ||
|
||
config.filter_run :focus | ||
config.run_all_when_everything_filtered = true | ||
|
||
if config.files_to_run.one? | ||
config.full_backtrace = true | ||
end | ||
|
||
# Run specs in random order to surface order dependencies. If you find an | ||
# order dependency and want to debug it, you can fix the order by providing | ||
# the seed, which is printed after each run. | ||
# --seed 1234 | ||
config.order = :random | ||
|
||
# Seed global randomization in this process using the `--seed` CLI option. | ||
# Setting this allows you to use `--seed` to deterministically reproduce | ||
# test failures related to randomization by passing the same `--seed` value | ||
# as the one that triggered the failure. | ||
Kernel.srand config.seed | ||
|
||
# TODO: Stop doing FileUtils.cd at runtime to avoid the need for this. | ||
config.before :each do | ||
FileUtils.cd File.expand_path(File.join(__FILE__, "..", "..")) | ||
end | ||
end |
4 changes: 2 additions & 2 deletions
4
test/vcdiff_code_table_spec.rb → spec/vcdiff_code_table_spec.rb
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,9 @@ | ||
require "test_helper" | ||
require "spec_helper" | ||
|
||
describe VCDIFF::CodeTable do | ||
describe "DEFAULT_TABLE" do | ||
it "has 256 entries" do | ||
VCDIFF::CodeTable::DEFAULT_TABLE.length == 256 | ||
end | ||
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
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,33 +1,31 @@ | ||
require "test_helper" | ||
require "spec_helper" | ||
|
||
describe VCDIFF::VCDIFFHeader do | ||
it "requires a valid header" do | ||
# requires VCD\0 with the uppermost bits set to 1 for "V","C","D" | ||
expect { VCDIFF::VCDIFFHeader.read("\xD6\xC3\xC4\x00") }.to_not raise_error(BinData::ValidityError) | ||
expect { VCDIFF::VCDIFFHeader.read("\x01\x02\x03\x00") }.to raise_error(BinData::ValidityError) | ||
end | ||
|
||
describe "#secondary_compressor?" do | ||
it "is true if the header_indicator has the appropriate bit set" do | ||
header = VCDIFF::VCDIFFHeader.read("\xD6\xC3\xC4\x00\x01\x00\x00\x00\x00\x00\x00") | ||
header.secondary_compressor?.should be_true | ||
header.header_indicator[0].should == 1 | ||
expect(header.secondary_compressor?).to be_truthy | ||
expect(header.header_indicator[0]).to eq(1) | ||
end | ||
end | ||
|
||
describe "#custom_codetable?" do | ||
it "is true if the header_indicator has the appropriate bit set" do | ||
# VCD\0 + 0b10 for custom code table, plus a bunch of zeroes to have enough bytes to read | ||
header = VCDIFF::VCDIFFHeader.read("\xD6\xC3\xC4\x00\x02\x00\x00\x00\x00\x00\x00") | ||
header.custom_codetable?.should be_true | ||
header.header_indicator[1].should == 1 | ||
expect(header.custom_codetable?).to be_truthy | ||
expect(header.header_indicator[1]).to eq(1) | ||
end | ||
end | ||
end | ||
|
||
describe VCDIFF::DeltaFile do | ||
it "requires a valid header" do | ||
expect { VCDIFF::DeltaFile.read("\xD6\xC3\xC4\x00") }.to_not raise_error(BinData::ValidityError) | ||
expect { VCDIFF::DeltaFile.read("\x01\x02\x03\x00") }.to raise_error(BinData::ValidityError) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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