Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

update rspec to 3.1 #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ gemspec

group :development do
gem 'coveralls', require: false
gem 'rspec'
gem 'rspec', '~> 3.1.0'
gem 'webmock'
gem 'guard'
gem 'guard-rspec'
gem 'guard-rspec', require: false
gem 'pry'
gem 'rake'
end
Expand Down
73 changes: 40 additions & 33 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ GEM
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.4)
celluloid (0.16.0)
timers (~> 4.0.0)
charlock_holmes (0.6.9.4)
coderay (1.0.9)
coderay (1.1.0)
colorize (0.5.8)
coveralls (0.6.7)
colorize
Expand All @@ -30,61 +32,66 @@ GEM
diff-lcs (1.2.5)
docile (1.1.5)
escape_utils (0.2.4)
ffi (1.8.1)
formatador (0.2.4)
ffi (1.9.6)
formatador (0.2.5)
gitlab-linguist (3.0.0)
charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.4)
mime-types (~> 1.19)
guard (1.8.0)
guard (2.10.0)
formatador (>= 0.2.4)
listen (>= 1.0.0)
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
thor (>= 0.14.6)
guard-rspec (2.5.4)
guard (>= 1.1)
rspec (~> 2.11)
listen (~> 2.7)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rspec (4.3.1)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
hitimes (1.2.2)
i18n (0.6.11)
json (1.8.1)
listen (1.0.2)
listen (2.8.3)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
lumberjack (1.0.3)
method_source (0.8.1)
lumberjack (1.0.9)
method_source (0.8.2)
mime-types (1.25.1)
minitest (5.4.2)
multi_json (1.10.1)
pry (0.9.12.1)
coderay (~> 1.0.5)
method_source (~> 0.8)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rake (10.3.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.0)
ffi (>= 0.5.0)
rb-kqueue (0.2.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-support (3.1.2)
rugged (0.21.2)
simplecov (0.9.0)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.4.4)
thor (0.18.1)
slop (3.6.0)
thor (0.19.1)
thread_safe (0.3.4)
timers (4.0.1)
hitimes
tzinfo (1.2.2)
thread_safe (~> 0.1)
webmock (1.11.0)
Expand All @@ -101,6 +108,6 @@ DEPENDENCIES
guard-rspec
pry
rake
rspec
rspec (~> 3.1.0)
simplecov
webmock
4 changes: 2 additions & 2 deletions spec/blame_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
context "each count" do
it do
blame.each do |commit, hunk_lines|
commit.should be_kind_of Gitlab::Git::Commit
hunk_lines.first.should == "# Contribute to GitLab"
expect(commit).to be_kind_of Gitlab::Git::Commit
hunk_lines.first == "# Contribute to GitLab"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/blob_snippet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
context 'empty lines' do
let(:snippet) { Gitlab::Git::BlobSnippet.new('master', nil, nil, nil) }

it { snippet.data.should be_nil }
it { snippet.data == nil }
end

context 'present lines' do
let(:snippet) { Gitlab::Git::BlobSnippet.new('master', ['wow', 'much'], 1, 'wow.rb') }

it { snippet.data.should == "wow\nmuch" }
it { snippet.data == "wow\nmuch" }
end
end
end
48 changes: 24 additions & 24 deletions spec/blob_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,61 @@
context 'file in subdir' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "files/ruby/popen.rb") }

it { blob.id.should == SeedRepo::RubyBlob::ID }
it { blob.name.should == SeedRepo::RubyBlob::NAME }
it { blob.path.should == "files/ruby/popen.rb" }
it { blob.commit_id.should == SeedRepo::Commit::ID }
it { blob.data[0..10].should == SeedRepo::RubyBlob::CONTENT[0..10] }
it { blob.size.should == 669 }
it { blob.id == SeedRepo::RubyBlob::ID }
it { blob.name == SeedRepo::RubyBlob::NAME }
it { blob.path == "files/ruby/popen.rb" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.commit_id == SeedRepo::Commit::ID }
it { blob.data[0..10] == SeedRepo::RubyBlob::CONTENT[0..10] }
it { blob.size == 669 }
end

context 'file in root' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, ".gitignore") }

it { blob.id.should == "dfaa3f97ca337e20154a98ac9d0be76ddd1fcc82" }
it { blob.name.should == ".gitignore" }
it { blob.path.should == ".gitignore" }
it { blob.commit_id.should == SeedRepo::Commit::ID }
it { blob.data[0..10].should == "*.rbc\n*.sas" }
it { blob.size.should == 241 }
it { blob.id == "dfaa3f97ca337e20154a98ac9d0be76ddd1fcc82" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.name == ".gitignore" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.path == ".gitignore" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.commit_id == SeedRepo::Commit::ID }
it { blob.data[0..10] == "*.rbc\n*.sas" }
it { blob.size == 241 }
end

context 'non-exist file' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "missing.rb") }

it { blob.should be_nil }
it { blob == nil }
end

context 'six submodule' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, 'six') }

it { blob.id.should == '409f37c4f05865e4fb208c771485f211a22c4c2d' }
it { blob.data.should == '' }
it { blob.id == '409f37c4f05865e4fb208c771485f211a22c4c2d' }
it { blob.data == '' }
end
end

describe :raw do
let(:raw_blob) { Gitlab::Git::Blob.raw(repository, SeedRepo::RubyBlob::ID) }
it { raw_blob.id.should == SeedRepo::RubyBlob::ID }
it { raw_blob.data[0..10].should == "require \'fi" }
it { raw_blob.size.should == 669 }
it { raw_blob.id == SeedRepo::RubyBlob::ID }
it { raw_blob.data[0..10] == "require \'fi" }
it { raw_blob.size == 669 }
end

describe 'encoding' do
context 'file with russian text' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "encoding/russian.rb") }

it { blob.name.should == "russian.rb" }
it { blob.data.lines.first.should == "Хороший файл" }
it { blob.size.should == 23 }
it { blob.name == "russian.rb" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.data.lines.first == "Хороший файл" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.size == 23 }
end

context 'file with Chinese text' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "encoding/テスト.txt") }

it { blob.name.should == "テスト.txt" }
it { blob.data.should include("これはテスト") }
it { blob.size.should == 340 }
it { blob.name == "テスト.txt" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { expect(blob.data).to include("これはテスト") }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

it { blob.size == 340 }
end
end
end
12 changes: 6 additions & 6 deletions spec/branch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
subject { repository.branches }

it { should be_kind_of Array }
its(:size) { should eq(3) }
it { subject.size == 3 }

describe 'first branch' do
let(:branch) { repository.branches.first }

it { branch.name.should == SeedRepo::Repo::BRANCHES.first }
it { branch.target.should == "0b4bc9a49b562e85de7cc9e834518ea6828729b9" }
it { branch.name == SeedRepo::Repo::BRANCHES.first }
it { branch.target == "0b4bc9a49b562e85de7cc9e834518ea6828729b9" }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer single-quoted strings when you don't need string interpolation or special symbols.

end

describe 'last branch' do
let(:branch) { repository.branches.last }

it { branch.name.should == SeedRepo::Repo::BRANCHES.last }
it { branch.target.should == SeedRepo::LastCommit::ID }
it { branch.name == SeedRepo::Repo::BRANCHES.last }
it { branch.target == SeedRepo::LastCommit::ID }
end

it { repository.branches.size.should == SeedRepo::Repo::BRANCHES.size }
it { repository.branches.size == SeedRepo::Repo::BRANCHES.size }
end
Loading