Commit fd6be573 authored by Valery Sizov's avatar Valery Sizov
Browse files

Merge branch 'rs-rspec3' into 'master'

RSpec 3

Updates CI's specs to be a bit more like CE's to make that transition a little easier.

See merge request !246
parents 305d9e20 77053a6c
--color
--color --format Fuubar
......@@ -103,37 +103,39 @@ gem "unf"
group :development do
gem 'brakeman', require: false
gem 'rack-mini-profiler', require: false
gem 'annotate'
gem 'quiet_assets'
gem "letter_opener"
gem "spring-commands-rspec"
gem 'quiet_assets'
gem 'rack-mini-profiler', require: false
end
group :development, :test do
gem 'spring', '~> 1.3.6'
gem 'minitest'
gem 'pry'
gem 'rspec-rails'
gem 'capybara'
gem 'poltergeist', '~> 1.5.1'
gem 'byebug', platform: :mri
gem 'fuubar', '~> 2.0.0'
gem 'pry-rails'
gem "database_cleaner", '~> 1.4.0'
gem 'factory_girl_rails'
gem "ffaker"
gem "byebug"
gem "database_cleaner"
gem 'shoulda-matchers'
gem 'guard-rspec'
gem 'rb-fsevent', require: darwin_only('rb-fsevent')
gem 'growl', require: darwin_only('growl')
gem 'rb-inotify', require: linux_only('rb-inotify')
gem "simplecov", require: false
gem 'rspec-rails', '~> 3.3.0'
gem 'rubocop', '0.28.0', require: false
gem 'capybara', '~> 2.4.0'
gem 'capybara-screenshot', '~> 1.0.0'
gem 'poltergeist', '~> 1.6.0'
gem 'spring', '~> 1.3.6'
gem 'spring-commands-rspec', '~> 1.0.0'
gem 'minitest'
gem 'ffaker', '~> 2.0.0'
gem 'coveralls', '~> 0.8.2', require: false
gem 'rubocop', '0.28.0', require: false
end
group :test do
gem 'webmock'
gem 'email_spec'
gem 'simplecov', require: false
gem 'shoulda-matchers', '~> 2.8.0', require: false
gem 'email_spec', '~> 1.6.0'
gem 'webmock', '~> 1.21.0'
end
......@@ -35,7 +35,7 @@ GEM
tzinfo (~> 1.1)
acts-as-taggable-on (3.4.3)
activerecord (>= 3.2, < 5)
addressable (2.3.5)
addressable (2.3.8)
annotate (2.6.0)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
......@@ -64,12 +64,15 @@ GEM
byebug (3.2.0)
columnize (~> 0.8)
debugger-linecache (~> 1.2)
capybara (2.1.0)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-screenshot (1.0.11)
capybara (>= 1.0, < 3)
launchy
celluloid (0.15.2)
timers (~> 1.1.0)
chronic (0.10.2)
......@@ -93,9 +96,9 @@ GEM
simplecov (~> 0.10.0)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
crack (0.4.1)
safe_yaml (~> 0.9.0)
database_cleaner (1.3.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
database_cleaner (1.4.1)
debugger-linecache (1.2.0)
default_value_for (3.0.0.1)
activerecord (>= 3.2.0, < 5.0)
......@@ -106,7 +109,7 @@ GEM
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
dotenv (0.9.0)
email_spec (1.5.0)
email_spec (1.6.0)
launchy (~> 2.1)
mail (~> 2.2)
encryptor (1.3.0)
......@@ -122,8 +125,7 @@ GEM
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
ffaker (1.22.1)
ffi (1.9.3)
ffaker (2.0.0)
fission (0.5.0)
CFPropertyList (~> 2.2)
fog (1.25.0)
......@@ -187,6 +189,9 @@ GEM
dotenv (>= 0.7)
thor (>= 0.13.6)
formatador (0.2.4)
fuubar (2.0.0)
rspec (~> 3.0)
ruby-progressbar (~> 1.4)
gitlab_ci_meta (4.0)
grape (0.6.1)
activesupport
......@@ -201,16 +206,6 @@ GEM
grape-entity (0.3.0)
activesupport
multi_json (>= 1.3.2)
growl (1.0.3)
guard (2.2.4)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rspec (4.2.0)
guard (>= 2.1.1)
rspec (>= 2.14, < 4.0)
haml (4.0.6)
tilt
haml-rails (0.5.3)
......@@ -245,15 +240,10 @@ GEM
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2)
launchy (2.4.2)
launchy (2.4.3)
addressable (~> 2.3)
letter_opener (1.1.2)
letter_opener (1.4.1)
launchy (~> 2.2)
listen (2.4.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
......@@ -288,16 +278,18 @@ GEM
parser (2.2.0.2)
ast (>= 1.1, < 3.0)
pg (0.17.0)
poltergeist (1.5.1)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
powerpack (0.0.9)
pry (0.9.12.4)
coderay (~> 1.0)
method_source (~> 0.8)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pry-rails (0.3.4)
pry (>= 0.9.10)
quiet_assets (1.0.2)
railties (>= 3.1, < 5.0)
rack (1.5.5)
......@@ -329,9 +321,6 @@ GEM
rainbow (2.0.0)
raindrops (0.13.0)
rake (10.4.2)
rb-fsevent (0.9.3)
rb-inotify (0.9.2)
ffi (>= 0.5.0)
rbvmomi (1.8.2)
builder
nokogiri (>= 1.4.1)
......@@ -344,21 +333,27 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-rails (3.3.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
rubocop (0.28.0)
astrolabe (~> 1.3)
parser (>= 2.2.0.pre.7, < 3.0)
......@@ -371,7 +366,7 @@ GEM
sexp_processor (~> 4.0)
ruby_parser (3.6.4)
sexp_processor (~> 4.1)
safe_yaml (0.9.7)
safe_yaml (1.0.4)
sass (3.2.19)
sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
......@@ -380,7 +375,7 @@ GEM
sprockets-rails (~> 2.0)
settingslogic (2.0.9)
sexp_processor (4.5.0)
shoulda-matchers (2.4.0)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
sidekiq (2.17.0)
celluloid (>= 0.15.2)
......@@ -401,7 +396,7 @@ GEM
slim (2.0.2)
temple (~> 0.6.6)
tilt (>= 1.3.3, < 2.1)
slop (3.4.7)
slop (3.6.0)
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
......@@ -445,10 +440,12 @@ GEM
coercible (~> 1.0)
descendants_tracker (~> 0.0.1)
equalizer (~> 0.0.7)
webmock (1.16.0)
addressable (>= 2.2.7)
webmock (1.21.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
websocket-driver (0.3.3)
websocket-driver (0.6.2)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
whenever (0.8.4)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
......@@ -467,23 +464,23 @@ DEPENDENCIES
bootstrap-sass (~> 3.0)
brakeman
byebug
capybara
capybara (~> 2.4.0)
capybara-screenshot (~> 1.0.0)
coffee-rails (~> 4.0.0)
colored
coveralls (~> 0.8.2)
database_cleaner
database_cleaner (~> 1.4.0)
default_value_for (~> 3.0.0)
email_spec
email_spec (~> 1.6.0)
factory_girl_rails
ffaker
ffaker (~> 2.0.0)
fog (~> 1.25.0)
font-awesome-rails (~> 3.2)
foreman
fuubar (~> 2.0.0)
gitlab_ci_meta (~> 4.0)
grape
grape-entity
growl
guard-rspec
haml-rails (~> 0.5.3)
hipchat (~> 1.5.0)
httparty (= 0.11.0)
......@@ -498,27 +495,25 @@ DEPENDENCIES
oauth2 (= 1.0.0)
paranoia (~> 2.0)
pg
poltergeist (~> 1.5.1)
pry
poltergeist (~> 1.6.0)
pry-rails
quiet_assets
rack-mini-profiler
rails (= 4.1.12)
rake
rb-fsevent
rb-inotify
request_store
rspec-rails
rspec-rails (~> 3.3.0)
rubocop (= 0.28.0)
sass-rails (~> 4.0.5)
settingslogic
shoulda-matchers
shoulda-matchers (~> 2.8.0)
sidekiq
simplecov
sinatra
slack-notifier (~> 1.0.0)
slim
spring (~> 1.3.6)
spring-commands-rspec
spring-commands-rspec (~> 1.0.0)
sprockets (~> 2.12.3)
stamp
state_machine
......@@ -527,5 +522,8 @@ DEPENDENCIES
unf
unicorn (~> 4.8.2)
virtus (= 1.0.1)
webmock
webmock (~> 1.21.0)
whenever
BUNDLED WITH
1.10.6
......@@ -61,8 +61,8 @@ describe ProjectsController do
it "creates project" do
allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user }
Network.any_instance.stub(:enable_ci).and_return(true)
Network.any_instance.stub(:project_hooks).and_return(true)
allow_any_instance_of(Network).to receive(:enable_ci).and_return(true)
allow_any_instance_of(Network).to receive(:project_hooks).and_return(true)
post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access
......@@ -73,7 +73,7 @@ describe ProjectsController do
it "shows error" do
allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user }
User.any_instance.stub(:can_manage_project?).and_return(false)
allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false)
post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access
......@@ -97,7 +97,7 @@ describe ProjectsController do
it "searches projects" do
allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user }
Network.any_instance.should_receive(:projects).with(hash_including(search: 'str'), :authorized)
expect_any_instance_of(Network).to receive(:projects).with(hash_including(search: 'str'), :authorized)
xhr :get, :gitlab, { search: "str", format: "js" }.with_indifferent_access
......
FactoryGirl.define do
factory :web_hook do
sequence(:url) { Faker::Internet.uri('http') }
sequence(:url) { FFaker::Internet.uri('http') }
project
end
end
require 'spec_helper'
describe "Admin Builds" do
describe "Admin Builds", feature: true do
let(:project) { FactoryGirl.create :project }
let(:commit) { FactoryGirl.create :commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit }
......@@ -16,8 +16,8 @@ describe "Admin Builds" do
visit admin_builds_path
end
it { page.should have_content "All builds" }
it { page.should have_content build.short_sha }
it { expect(page).to have_content "All builds" }
it { expect(page).to have_content build.short_sha }
end
describe "Tabs" do
......@@ -29,7 +29,7 @@ describe "Admin Builds" do
visit admin_builds_path
page.all(".build-link").size.should == 4
expect(page.all(".build-link").size).to eq 4
end
it "shows pending builds" do
......@@ -44,10 +44,10 @@ describe "Admin Builds" do
click_on "Pending"
end
page.find(".build-link").should have_content(build.id)
page.find(".build-link").should_not have_content(build1.id)
page.find(".build-link").should_not have_content(build2.id)
page.find(".build-link").should_not have_content(build3.id)
expect(page.find(".build-link")).to have_content(build.id)
expect(page.find(".build-link")).not_to have_content(build1.id)
expect(page.find(".build-link")).not_to have_content(build2.id)
expect(page.find(".build-link")).not_to have_content(build3.id)
end
it "shows running builds" do
......@@ -62,10 +62,10 @@ describe "Admin Builds" do
click_on "Running"
end
page.find(".build-link").should have_content(build1.id)
page.find(".build-link").should_not have_content(build.id)
page.find(".build-link").should_not have_content(build2.id)
page.find(".build-link").should_not have_content(build3.id)
expect(page.find(".build-link")).to have_content(build1.id)
expect(page.find(".build-link")).not_to have_content(build.id)
expect(page.find(".build-link")).not_to have_content(build2.id)
expect(page.find(".build-link")).not_to have_content(build3.id)
end
end
end
require 'spec_helper'
describe "Admin Events" do
describe "Admin Events", feature: true do
let(:event) { FactoryGirl.create :admin_event }
before do
......@@ -14,7 +14,7 @@ describe "Admin Events" do
visit admin_events_path
end
it { page.should have_content "Events" }
it { page.should have_content event.description }
it { expect(page).to have_content "Events" }
it { expect(page).to have_content event.description }
end
end
require 'spec_helper'
describe "Admin Projects" do
describe "Admin Projects", feature: true do
let(:project) { FactoryGirl.create :project }
before do
......@@ -14,6 +14,6 @@ describe "Admin Projects" do
visit admin_projects_path
end
it { page.should have_content "Projects" }
it { expect(page).to have_content "Projects" }
end
end
require 'spec_helper'
describe "Admin Runners" do
describe "Admin Runners", feature: true do
before do
skip_admin_auth
login_as :user
......@@ -27,8 +27,8 @@ describe "Admin Runners" do
click_button 'Search'
end
it { page.should have_content("foo") }
it { page.should_not have_content("bar") }
it { expect(page).to have_content("foo") }
it { expect(page).not_to have_content("bar") }
end
end
......@@ -42,12 +42,12 @@ describe "Admin Runners" do
end
describe 'runner info' do
it { find_field('runner_token').value.should eq runner.token }
it { expect(find_field('runner_token').value).to eq runner.token }
end
describe 'projects' do
it { page.should have_content("foo") }
it { page.should have_content("bar") }
it { expect(page).to have_content("foo") }
it { expect(page).to have_content("bar") }
end
describe 'search' do
......@@ -56,8 +56,8 @@ describe "Admin Runners" do
click_button 'Search'
end
it { page.should have_content("foo") }
it { page.should_not have_content("bar") }
it { expect(page).to have_content("foo") }
it { expect(page).not_to have_content("bar") }
end
end
end
require 'spec_helper'
describe "Builds" do
describe "Builds", feature: true do
before do
@project = FactoryGirl.create :project
@commit = FactoryGirl.create :commit, project: @project
......@@ -13,9 +13,9 @@ describe "Builds" do
visit project_build_path(@project, @build)
end
it { page.should have_content @commit.sha[0..7] }
it { page.should have_content @commit.git_commit_message }
it { page.should have_content @commit.git_author_name }
it { expect(page).to have_content @commit.sha[0..7] }
it { expect(page).to have_content @commit.git_commit_message }
it { expect(page).to have_content @commit.git_author_name }
end
describe "GET /:project/builds/:id/cancel" do
......@@ -25,8 +25,8 @@ describe "Builds" do
visit cancel_project_build_path(@project, @build)
end
it { page.should have_content 'canceled' }
it { page.should have_content 'Retry' }
it { expect(page).to have_content 'canceled' }
it { expect(page).to have_content 'Retry' }
end
describe "POST /:project/builds/:id/retry" do
......@@ -37,8 +37,8 @@ describe "Builds" do
click_link 'Retry'
end
it { page.should have_content 'pending' }
it { page.should have_content 'Cancel' }
it { expect(page).to have_content 'pending' }
it { expect(page).to have_content 'Cancel' }
end
describe "Show page public accessible" do
......@@ -52,6 +52,6 @@ describe "Builds" do
visit project_build_path(@project, @build)
end
it { page.should have_content @commit.sha[0..7] }
it { expect(page).to have_content @commit.sha[0..7] }
end
end
require 'spec_helper'
describe "Commits" do
describe "Commits", feature: true do
context "Authenticated user" do
before do
login_as :user
......@@ -14,9 +14,9 @@ describe "Commits" do
visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
end
it { page.should have_content @commit.sha[0..7] }
it { page.should have_content @commit.git_commit_message }
it { page.should have_content @commit.git_author_name }
it { expect(page).to have_content @commit.sha[0..7] }
it { expect(page).to have_content @commit.git_commit_message }
it { expect(page).to have_content @commit.git_author_name }
end
describe "Cancel commit" do
......@@ -24,7 +24,7 @@ describe "Commits" do
visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
click_on "Cancel"
page.should have_content "canceled"
expect(page).to have_content "canceled"
end
end
......@@ -32,7 +32,7 @@ describe "Commits" do
it "does not show warning" do
visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
page.should_not have_content ".gitlab-ci.yml not found in this commit"
expect(page).not_to have_content ".gitlab-ci.yml not found in this commit"
end
it "shows warning" do
......@@ -41,7 +41,7 @@ describe "Commits" do
visit project_ref_commit_path(@project, @commit.ref, @commit.sha)
page.should have_content ".gitlab-ci.yml not found in this commit"
expect(page).to have_content ".gitlab-ci.yml not found in this commit"
end
end
end
......@@ -58,9 +58,9 @@ describe "Commits" do
visit project_ref_commit_path(@project, @commit.ref, @commit.sha