Commit 1343b2df authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #8785 from jvanbaarsen/rspec-upgrade

Rspec upgrade
parents f9880c11 68600044
...@@ -222,7 +222,7 @@ group :development, :test do ...@@ -222,7 +222,7 @@ group :development, :test do
gem 'rubocop', '0.28.0', require: false gem 'rubocop', '0.28.0', require: false
# gem 'rails-dev-tweaks' # gem 'rails-dev-tweaks'
gem 'spinach-rails' gem 'spinach-rails'
gem "rspec-rails" gem "rspec-rails", '2.99'
gem "capybara", '~> 2.2.1' gem "capybara", '~> 2.2.1'
gem "pry-rails" gem "pry-rails"
gem "awesome_print" gem "awesome_print"
......
...@@ -459,21 +459,25 @@ GEM ...@@ -459,21 +459,25 @@ GEM
mime-types (>= 1.16) mime-types (>= 1.16)
rinku (1.7.3) rinku (1.7.3)
rouge (1.7.4) rouge (1.7.4)
rspec (2.14.1) rspec (2.99.0)
rspec-core (~> 2.14.0) rspec-core (~> 2.99.0)
rspec-expectations (~> 2.14.0) rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.14.0) rspec-mocks (~> 2.99.0)
rspec-core (2.14.7) rspec-collection_matchers (1.1.2)
rspec-expectations (2.14.4) rspec-expectations (>= 2.99.0.beta1)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0) diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4) rspec-mocks (2.99.3)
rspec-rails (2.14.0) rspec-rails (2.99.0)
actionpack (>= 3.0) actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
railties (>= 3.0) railties (>= 3.0)
rspec-core (~> 2.14.0) rspec-collection_matchers
rspec-expectations (~> 2.14.0) rspec-core (~> 2.99.0)
rspec-mocks (~> 2.14.0) rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rubocop (0.28.0) rubocop (0.28.0)
astrolabe (~> 1.3) astrolabe (~> 1.3)
parser (>= 2.2.0.pre.7, < 3.0) parser (>= 2.2.0.pre.7, < 3.0)
...@@ -724,7 +728,7 @@ DEPENDENCIES ...@@ -724,7 +728,7 @@ DEPENDENCIES
redcarpet (~> 3.1.2) redcarpet (~> 3.1.2)
redis-rails redis-rails
request_store request_store
rspec-rails rspec-rails (= 2.99)
rubocop (= 0.28.0) rubocop (= 0.28.0)
rugments rugments
sanitize (~> 2.0) sanitize (~> 2.0)
......
...@@ -4,4 +4,4 @@ begin ...@@ -4,4 +4,4 @@ begin
rescue LoadError rescue LoadError
end end
require 'bundler/setup' require 'bundler/setup'
load Gem.bin_path('rspec', 'rspec') load Gem.bin_path('rspec-core', 'rspec')
...@@ -17,7 +17,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps ...@@ -17,7 +17,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
end end
step 'I should see project "Community" home page' do step 'I should see project "Community" home page' do
Gitlab.config.gitlab.stub(:host).and_return("www.example.com") Gitlab.config.gitlab.should_receive(:host).and_return("www.example.com")
within '.navbar-gitlab .title' do within '.navbar-gitlab .title' do
page.should have_content 'Community' page.should have_content 'Community'
end end
......
...@@ -47,8 +47,8 @@ Spinach.hooks.after_scenario do ...@@ -47,8 +47,8 @@ Spinach.hooks.after_scenario do
end end
Spinach.hooks.before_run do Spinach.hooks.before_run do
include RSpec::Mocks::ExampleMethods
TestEnv.init(mailer: false) TestEnv.init(mailer: false)
RSpec::Mocks::setup self
include FactoryGirl::Syntax::Methods include FactoryGirl::Syntax::Methods
end end
...@@ -7,26 +7,26 @@ describe ApplicationController do ...@@ -7,26 +7,26 @@ describe ApplicationController do
it 'should redirect if the user is over their password expiry' do it 'should redirect if the user is over their password expiry' do
user.password_expires_at = Time.new(2002) user.password_expires_at = Time.new(2002)
user.ldap_user?.should be_false expect(user.ldap_user?).to be_falsey
controller.stub(:current_user).and_return(user) allow(controller).to receive(:current_user).and_return(user)
controller.should_receive(:redirect_to) expect(controller).to receive(:redirect_to)
controller.should_receive(:new_profile_password_path) expect(controller).to receive(:new_profile_password_path)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
end end
it 'should not redirect if the user is under their password expiry' do it 'should not redirect if the user is under their password expiry' do
user.password_expires_at = Time.now + 20010101 user.password_expires_at = Time.now + 20010101
user.ldap_user?.should be_false expect(user.ldap_user?).to be_falsey
controller.stub(:current_user).and_return(user) allow(controller).to receive(:current_user).and_return(user)
controller.should_not_receive(:redirect_to) expect(controller).not_to receive(:redirect_to)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
end end
it 'should not redirect if the user is over their password expiry but they are an ldap user' do it 'should not redirect if the user is over their password expiry but they are an ldap user' do
user.password_expires_at = Time.new(2002) user.password_expires_at = Time.new(2002)
user.stub(:ldap_user?).and_return(true) allow(user).to receive(:ldap_user?).and_return(true)
controller.stub(:current_user).and_return(user) allow(controller).to receive(:current_user).and_return(user)
controller.should_not_receive(:redirect_to) expect(controller).not_to receive(:redirect_to)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
end end
end end
......
...@@ -9,8 +9,8 @@ describe Projects::BlobController do ...@@ -9,8 +9,8 @@ describe Projects::BlobController do
project.team << [user, :master] project.team << [user, :master]
project.stub(:branches).and_return(['master', 'foo/bar/baz']) allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz'])
project.stub(:tags).and_return(['v1.0.0', 'v2.0.0']) allow(project).to receive(:tags).and_return(['v1.0.0', 'v2.0.0'])
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
end end
...@@ -21,17 +21,17 @@ describe Projects::BlobController do ...@@ -21,17 +21,17 @@ describe Projects::BlobController do
context "valid branch, valid file" do context "valid branch, valid file" do
let(:id) { 'master/README.md' } let(:id) { 'master/README.md' }
it { should respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "valid branch, invalid file" do context "valid branch, invalid file" do
let(:id) { 'master/invalid-path.rb' } let(:id) { 'master/invalid-path.rb' }
it { should respond_with(:not_found) } it { is_expected.to respond_with(:not_found) }
end end
context "invalid branch, valid file" do context "invalid branch, valid file" do
let(:id) { 'invalid-branch/README.md' } let(:id) { 'invalid-branch/README.md' }
it { should respond_with(:not_found) } it { is_expected.to respond_with(:not_found) }
end end
end end
...@@ -45,7 +45,10 @@ describe Projects::BlobController do ...@@ -45,7 +45,10 @@ describe Projects::BlobController do
context 'redirect to tree' do context 'redirect to tree' do
let(:id) { 'markdown/doc' } let(:id) { 'markdown/doc' }
it { should redirect_to("/#{project.path_with_namespace}/tree/markdown/doc") } it 'redirects' do
expect(subject).
to redirect_to("/#{project.path_with_namespace}/tree/markdown/doc")
end
end end
end end
end end
...@@ -9,8 +9,8 @@ describe Projects::BranchesController do ...@@ -9,8 +9,8 @@ describe Projects::BranchesController do
project.team << [user, :master] project.team << [user, :master]
project.stub(:branches).and_return(['master', 'foo/bar/baz']) allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz'])
project.stub(:tags).and_return(['v1.0.0', 'v2.0.0']) allow(project).to receive(:tags).and_return(['v1.0.0', 'v2.0.0'])
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
end end
...@@ -27,25 +27,31 @@ describe Projects::BranchesController do ...@@ -27,25 +27,31 @@ describe Projects::BranchesController do
context "valid branch name, valid source" do context "valid branch name, valid source" do
let(:branch) { "merge_branch" } let(:branch) { "merge_branch" }
let(:ref) { "master" } let(:ref) { "master" }
it { should redirect_to("/#{project.path_with_namespace}/tree/merge_branch") } it 'redirects' do
expect(subject).
to redirect_to("/#{project.path_with_namespace}/tree/merge_branch")
end
end end
context "invalid branch name, valid ref" do context "invalid branch name, valid ref" do
let(:branch) { "<script>alert('merge');</script>" } let(:branch) { "<script>alert('merge');</script>" }
let(:ref) { "master" } let(:ref) { "master" }
it { should redirect_to("/#{project.path_with_namespace}/tree/alert('merge');") } it 'redirects' do
expect(subject).
to redirect_to("/#{project.path_with_namespace}/tree/alert('merge');")
end
end end
context "valid branch name, invalid ref" do context "valid branch name, invalid ref" do
let(:branch) { "merge_branch" } let(:branch) { "merge_branch" }
let(:ref) { "<script>alert('ref');</script>" } let(:ref) { "<script>alert('ref');</script>" }
it { should render_template("new") } it { is_expected.to render_template('new') }
end end
context "invalid branch name, invalid ref" do context "invalid branch name, invalid ref" do
let(:branch) { "<script>alert('merge');</script>" } let(:branch) { "<script>alert('merge');</script>" }
let(:ref) { "<script>alert('ref');</script>" } let(:ref) { "<script>alert('ref');</script>" }
it { should render_template("new") } it { is_expected.to render_template('new') }
end end
end end
end end
...@@ -19,7 +19,7 @@ describe Projects::CommitController do ...@@ -19,7 +19,7 @@ describe Projects::CommitController do
end end
it "should generate it" do it "should generate it" do
Commit.any_instance.should_receive(:"to_#{format}") expect_any_instance_of(Commit).to receive(:"to_#{format}")
get :show, project_id: project.to_param, id: commit.id, format: format get :show, project_id: project.to_param, id: commit.id, format: format
end end
...@@ -31,7 +31,8 @@ describe Projects::CommitController do ...@@ -31,7 +31,8 @@ describe Projects::CommitController do
end end
it "should not escape Html" do it "should not escape Html" do
Commit.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') allow_any_instance_of(Commit).to receive(:"to_#{format}").
and_return('HTML entities &<>" ')
get :show, project_id: project.to_param, id: commit.id, format: format get :show, project_id: project.to_param, id: commit.id, format: format
......
...@@ -13,8 +13,8 @@ describe Projects::CommitsController do ...@@ -13,8 +13,8 @@ describe Projects::CommitsController do
context "as atom feed" do context "as atom feed" do
it "should render as atom" do it "should render as atom" do
get :show, project_id: project.to_param, id: "master", format: "atom" get :show, project_id: project.to_param, id: "master", format: "atom"
response.should be_success expect(response).to be_success
response.content_type.should == 'application/atom+xml' expect(response.content_type).to eq('application/atom+xml')
end end
end end
end end
......
...@@ -10,13 +10,16 @@ describe Import::GithubController do ...@@ -10,13 +10,16 @@ describe Import::GithubController do
describe "GET callback" do describe "GET callback" do
it "updates access token" do it "updates access token" do
token = "asdasd12345" token = "asdasd12345"
Gitlab::GithubImport::Client.any_instance.stub(:get_token).and_return(token) allow_any_instance_of(Gitlab::GithubImport::Client).
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "github") to receive(:get_token).and_return(token)
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: 'asd123',
app_secret: 'asd123',
name: 'github')
get :callback get :callback
user.reload.github_access_token.should == token expect(user.reload.github_access_token).to eq(token)
controller.should redirect_to(status_import_github_url) expect(controller).to redirect_to(status_import_github_url)
end end
end end
...@@ -55,7 +58,8 @@ describe Import::GithubController do ...@@ -55,7 +58,8 @@ describe Import::GithubController do
it "takes already existing namespace" do it "takes already existing namespace" do
namespace = create(:namespace, name: "john", owner: user) namespace = create(:namespace, name: "john", owner: user)
Gitlab::GithubImport::ProjectCreator.should_receive(:new).with(@repo, namespace, user). expect(Gitlab::GithubImport::ProjectCreator).
to receive(:new).with(@repo, namespace, user).
and_return(double(execute: true)) and_return(double(execute: true))
controller.stub_chain(:client, :repo).and_return(@repo) controller.stub_chain(:client, :repo).and_return(@repo)
......
...@@ -14,9 +14,9 @@ describe Import::GitlabController do ...@@ -14,9 +14,9 @@ describe Import::GitlabController do
Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "gitlab") Gitlab.config.omniauth.providers << OpenStruct.new(app_id: "asd123", app_secret: "asd123", name: "gitlab")
get :callback get :callback
user.reload.gitlab_access_token.should == token expect(user.reload.gitlab_access_token).to eq(token)
controller.should redirect_to(status_import_gitlab_url) expect(controller).to redirect_to(status_import_gitlab_url)
end end
end end
...@@ -28,7 +28,7 @@ describe Import::GitlabController do ...@@ -28,7 +28,7 @@ describe Import::GitlabController do
it "assigns variables" do it "assigns variables" do
@project = create(:project, import_type: 'gitlab', creator_id: user.id) @project = create(:project, import_type: 'gitlab', creator_id: user.id)
controller.stub_chain(:client, :projects).and_return([@repo]) controller.stub_chain(:client, :projects).and_return([@repo])
get :status get :status
expect(assigns(:already_added_projects)).to eq([@project]) expect(assigns(:already_added_projects)).to eq([@project])
...@@ -38,7 +38,7 @@ describe Import::GitlabController do ...@@ -38,7 +38,7 @@ describe Import::GitlabController do
it "does not show already added project" do it "does not show already added project" do
@project = create(:project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim') @project = create(:project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim')
controller.stub_chain(:client, :projects).and_return([@repo]) controller.stub_chain(:client, :projects).and_return([@repo])
get :status get :status
expect(assigns(:already_added_projects)).to eq([@project]) expect(assigns(:already_added_projects)).to eq([@project])
...@@ -58,7 +58,8 @@ describe Import::GitlabController do ...@@ -58,7 +58,8 @@ describe Import::GitlabController do
it "takes already existing namespace" do it "takes already existing namespace" do
namespace = create(:namespace, name: "john", owner: user) namespace = create(:namespace, name: "john", owner: user)
Gitlab::GitlabImport::ProjectCreator.should_receive(:new).with(@repo, namespace, user). expect(Gitlab::GitlabImport::ProjectCreator).
to receive(:new).with(@repo, namespace, user).
and_return(double(execute: true)) and_return(double(execute: true))
controller.stub_chain(:client, :project).and_return(@repo) controller.stub_chain(:client, :project).and_return(@repo)
......
...@@ -19,7 +19,7 @@ describe Projects::MergeRequestsController do ...@@ -19,7 +19,7 @@ describe Projects::MergeRequestsController do
end end
it "should generate it" do it "should generate it" do
MergeRequest.any_instance.should_receive(:"to_#{format}") expect_any_instance_of(MergeRequest).to receive(:"to_#{format}")
get :show, project_id: project.to_param, id: merge_request.iid, format: format get :show, project_id: project.to_param, id: merge_request.iid, format: format
end end
...@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do ...@@ -31,7 +31,8 @@ describe Projects::MergeRequestsController do
end end
it "should not escape Html" do it "should not escape Html" do
MergeRequest.any_instance.stub(:"to_#{format}").and_return('HTML entities &<>" ') allow_any_instance_of(MergeRequest).to receive(:"to_#{format}").
and_return('HTML entities &<>" ')
get :show, project_id: project.to_param, id: merge_request.iid, format: format get :show, project_id: project.to_param, id: merge_request.iid, format: format
......
...@@ -45,18 +45,18 @@ describe ProjectsController do ...@@ -45,18 +45,18 @@ describe ProjectsController do
describe "POST #toggle_star" do describe "POST #toggle_star" do
it "toggles star if user is signed in" do it "toggles star if user is signed in" do
sign_in(user) sign_in(user)
expect(user.starred?(public_project)).to be_false expect(user.starred?(public_project)).to be_falsey
post :toggle_star, id: public_project.to_param post :toggle_star, id: public_project.to_param
expect(user.starred?(public_project)).to be_true expect(user.starred?(public_project)).to be_truthy
post :toggle_star, id: public_project.to_param post :toggle_star, id: public_project.to_param
expect(user.starred?(public_project)).to be_false expect(user.starred?(public_project)).to be_falsey
end end
it "does nothing if user is not signed in" do it "does nothing if user is not signed in" do
post :toggle_star, id: public_project.to_param post :toggle_star, id: public_project.to_param
expect(user.starred?(public_project)).to be_false expect(user.starred?(public_project)).to be_falsey
post :toggle_star, id: public_project.to_param post :toggle_star, id: public_project.to_param
expect(user.starred?(public_project)).to be_false expect(user.starred?(public_project)).to be_falsey
end end
end end
end end
...@@ -9,8 +9,8 @@ describe Projects::TreeController do ...@@ -9,8 +9,8 @@ describe Projects::TreeController do
project.team << [user, :master] project.team << [user, :master]
project.stub(:branches).and_return(['master', 'foo/bar/baz']) allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz'])
project.stub(:tags).and_return(['v1.0.0', 'v2.0.0']) allow(project).to receive(:tags).and_return(['v1.0.0', 'v2.0.0'])
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
end end
...@@ -22,22 +22,22 @@ describe Projects::TreeController do ...@@ -22,22 +22,22 @@ describe Projects::TreeController do
context "valid branch, no path" do context "valid branch, no path" do
let(:id) { 'master' } let(:id) { 'master' }
it { should respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "valid branch, valid path" do context "valid branch, valid path" do
let(:id) { 'master/encoding/' } let(:id) { 'master/encoding/' }
it { should respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "valid branch, invalid path" do context "valid branch, invalid path" do
let(:id) { 'master/invalid-path/' } let(:id) { 'master/invalid-path/' }
it { should respond_with(:not_found) } it { is_expected.to respond_with(:not_found) }
end end
context "invalid branch, valid path" do context "invalid branch, valid path" do
let(:id) { 'invalid-branch/encoding/' } let(:id) { 'invalid-branch/encoding/' }
it { should respond_with(:not_found) } it { is_expected.to respond_with(:not_found) }
end end
end end
...@@ -50,7 +50,11 @@ describe Projects::TreeController do ...@@ -50,7 +50,11 @@ describe Projects::TreeController do
context 'redirect to blob' do context 'redirect to blob' do
let(:id) { 'master/README.md' } let(:id) { 'master/README.md' }
it { should redirect_to("/#{project.path_with_namespace}/blob/master/README.md") } it 'redirects' do
redirect_url = "/#{project.path_with_namespace}/blob/master/README.md"
expect(subject).
to redirect_to(redirect_url)
end
end end
end end
end end
...@@ -9,7 +9,7 @@ FactoryGirl.factories.map(&:name).each do |factory_name| ...@@ -9,7 +9,7 @@ FactoryGirl.factories.map(&:name).each do |factory_name|
next if INVALID_FACTORIES.include?(factory_name) next if INVALID_FACTORIES.include?(factory_name)
describe "#{factory_name} factory" do describe "#{factory_name} factory" do
it 'should be valid' do it 'should be valid' do
build(factory_name).should be_valid expect(build(factory_name)).to be_valid
end end
end end
end end
...@@ -15,12 +15,12 @@ describe "Admin::Hooks", feature: true do ...@@ -15,12 +15,12 @@ describe "Admin::Hooks", feature: true do
within ".sidebar-wrapper" do within ".sidebar-wrapper" do
click_on "Hooks" click_on "Hooks"
end end
current_path.should == admin_hooks_path expect(current_path).to eq(admin_hooks_path)
end end
it "should have hooks list" do it "should have hooks list" do
visit admin_hooks_path visit admin_hooks_path
page.should have_content(@system_hook.url) expect(page).to have_content(@system_hook.url)
end end
end end
...@@ -33,8 +33,8 @@ describe "Admin::Hooks", feature: true do ...@@ -33,8 +33,8 @@ describe "Admin::Hooks", feature: true do
end end
it "should open new hook popup" do it "should open new hook popup" do
current_path.should == admin_hooks_path expect(current_path).to eq(admin_hooks_path)
page.should have_content(@url) expect(page).to have_content(@url)
end end
end end
...@@ -45,7 +45,7 @@ describe "Admin::Hooks", feature: true do ...@@ -45,7 +45,7 @@ describe "Admin::Hooks", feature: true do
click_link "Test Hook" click_link "Test Hook"
end end
it { current_path.should == admin_hooks_path } it { expect(current_path).to eq(admin_hooks_path) }
end end
end end
...@@ -12,11 +12,11 @@ describe "Admin::Projects", feature: true do ...@@ -12,11 +12,11 @@ describe "Admin::Projects", feature: true do
end end
it "should be ok" do it "should be ok" do
current_path.should == admin_projects_path expect(current_path).to eq(admin_projects_path)
end end
it "should have projects list" do it "should have projects list" do
page.should have_content(@project.name) expect(page).to have_content(@project.name)
end end
end end
...@@ -27,8 +27,8 @@ describe "Admin::Projects", feature: true do ...@@ -27,8 +27,8 @@ describe "Admin::Projects", feature: true do
end end
it "should have project info" do it "should have project info" do
page.should have_content(@project.path) expect(page).to have_content(@project.path)
page.should have_content(@project.name) expect(page).to have_content(@project.name)
end end
end end
end end
...@@ -9,12 +9,12 @@ describe "Admin::Users", feature: true do ...@@ -9,12 +9,12 @@ describe "Admin::Users", feature: true do
end end
it "should be ok" do it "should be ok" do
current_path.should == admin_users_path expect(current_path).to eq(admin_users_path)
end end
it "should have users list" do it "should have users list" do
page.should have_content(@user.email) expect(page).to have_content(@user.email)
page.should have_content(@user.name) expect(page).to have_content(@user.name)
end end
end end
...@@ -33,19 +33,21 @@ describe "Admin::Users", feature: true do ...@@ -33,19 +33,21 @@ describe "Admin::Users", feature: true do
it "should apply defaults to user" do it "should apply defaults to user" do
click_button "Create user" click_button "Create user"
user = User.find_by(username: 'bang') user = User.find_by(username: 'bang')
user.projects_limit.should == Gitlab.config.gitlab.default_projects_limit expect(user.projects_limit).
user.can_create_group.should == Gitlab.config.gitlab.default_can_create_group to eq(Gitlab.config.gitlab.default_projects_limit)
expect(user.can_create_group).
to eq(Gitlab.config.gitlab.default_can_create_group)
end end
it "should create user with valid data" do it "should create user with valid data" do
click_button "Create user" click_button "Create user"
user = User.find_by(username: 'bang') user = User.find_by(username: 'bang')
user.name.should == "Big Bang" expect(user.name).to eq('Big Bang')
user.email.should == "bigbang@mail.com" expect(user.email).to eq('bigbang@mail.com')
end end
it "should call send mail" do it "should call send mail" do
Notify.should_receive(:new_user_email) expect(Notify).to receive(:new_user_email)
click_button "Create user" click_button "Create user"
end end
...@@ -54,9 +56,9 @@ describe "Admin::Users", feature: true do ...@@ -54,9 +56,9 @@ describe "Admin::Users", feature: true do
click_button "Create user" click_button "Create user"
user = User.find_by(username: 'bang') user = User.find_by(username: 'bang')
email = ActionMailer::Base.deliveries.last email = ActionMailer::Base.deliveries.last
email.subject.should have_content("Account was created") expect(email.subject).to have_content('Account was created')
email.text_part.body.should have_content(user.email) expect(email.text_part.body).to have_content(user.email)
email.text_part.body.should have_content('password') expect(email.text_part.body).to have_content('password')
end end
end end
...@@ -67,8 +69,8 @@ describe "Admin::Users", feature: true do ...@@ -67,8 +69,8 @@ describe "Admin::Users", feature: true do
end end
it "should have user info" do it "should have user info" do
page.should have_content(@user.email) expect(page).to have_content(@user.email)
page.should have_content(@user.name) expect(page).to have_content(@user.name)
end end
end end
...@@ -80,8 +82,8 @@ describe "Admin::Users", feature: true do ...@@ -80,8 +82,8 @@ describe "Admin::Users", feature: true do
end end
it "should have user edit page" do it "should have user edit page" do
page.should have_content("Name") expect(page).to have_content('Name')
page.should have_content("Password") expect(page).to have_content('Password')
end end
describe "Update user" do describe "Update user" do
...@@ -93,14 +95,14 @@ describe "Admin::Users", feature: true do ...@@ -93,14 +95,14 @@ describe "Admin::Users", feature: true do
end end
it "should show page with new data" do it "should show page with new data" do
page.should have_content("bigbang@mail.com") expect(page).to have_content('bigbang@mail.com')
page.should have_content("Big Bang") expect(page).to have_content('Big Bang')
end end
it "should change user entry" do it "should change user entry" do
@simple_user.reload @simple_user.reload
@simple_user.name.should == "Big Bang" expect(@simple_user.name).to eq('Big Bang')
@simple_user.is_admin?.should be_true expect(@simple_user.is_admin?).to be_truthy
end end
end end
end end
......
...@@ -4,24 +4,24 @@ describe "Admin::Projects", feature: true do ...@@ -4,24 +4,24 @@ describe "Admin::Projects", feature: true do
describe "GET /admin/projects" do describe "GET /admin/projects" do
subject { admin_projects_path } subject { admin_projects_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /admin/users" do describe "GET /admin/users" do
subject { admin_users_path } subject { admin_users_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /admin/hooks" do describe "GET /admin/hooks" do
subject { admin_hooks_path } subject { admin_hooks_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
...@@ -17,12 +17,13 @@ describe "Dashboard Issues Feed", feature: true do ...@@ -17,12 +17,13 @@ describe "Dashboard Issues Feed", feature: true do
it "should render atom feed via private token" do it "should render atom feed via private token" do
visit issues_dashboard_path(:atom, private_token: user.private_token) visit issues_dashboard_path(:atom, private_token: user.private_token)
response_headers['Content-Type'].should have_content("application/atom+xml") expect(response_headers['Content-Type']).
body.should have_selector("title", text: "#{user.name} issues") to have_content('application/atom+xml')
body.should have_selector("author email", text: issue1.author_email) expect(body).to have_selector('title', text: "#{user.name} issues")
body.should have_selector("entry summary", text: issue1.title) expect(body).to have_selector('author email', text: issue1.author_email)
body.should have_selector("author email", text: issue2.author_email) expect(body).to have_selector('entry summary', text: issue1.title)
body.should have_selector("entry summary", text: issue2.title) expect(body).to have_selector('author email', text: issue2.author_email)
expect(body).to have_selector('entry summary', text: issue2.title)
end end
end end
end end
......
...@@ -7,7 +7,7 @@ describe "Dashboard Feed", feature: true do ...@@ -7,7 +7,7 @@ describe "Dashboard Feed", feature: true do
context "projects atom feed via private token" do context "projects atom feed via private token" do
it "should render projects atom feed" do it "should render projects atom feed" do
visit dashboard_path(:atom, private_token: user.private_token) visit dashboard_path(:atom, private_token: user.private_token)
body.should have_selector("feed title") expect(body).to have_selector('feed title')
end end
end end
...@@ -24,11 +24,12 @@ describe "Dashboard Feed", feature: true do ...@@ -24,11 +24,12 @@ describe "Dashboard Feed", feature: true do
end end
it "should have issue opened event" do it "should have issue opened event" do
body.should have_content("#{user.name} opened issue ##{issue.iid}") expect(body).to have_content("#{user.name} opened issue ##{issue.iid}")
end end
it "should have issue comment event" do it "should have issue comment event" do
body.should have_content("#{user.name} commented on issue ##{issue.iid}") expect(body).
to have_content("#{user.name} commented on issue ##{issue.iid}")
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe "Issues Feed", feature: true do describe 'Issues Feed', feature: true do
describe "GET /issues" do describe 'GET /issues' do
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:project) { create(:project) } let!(:project) { create(:project) }
let!(:issue) { create(:issue, author: user, project: project) } let!(:issue) { create(:issue, author: user, project: project) }
before { project.team << [user, :developer] } before { project.team << [user, :developer] }
context "when authenticated" do context 'when authenticated' do
it "should render atom feed" do it 'should render atom feed' do
login_with user login_with user
visit project_issues_path(project, :atom) visit project_issues_path(project, :atom)
response_headers['Content-Type'].should have_content("application/atom+xml") expect(response_headers['Content-Type']).
body.should have_selector("title", text: "#{project.name} issues") to have_content('application/atom+xml')
body.should have_selector("author email", text: issue.author_email) expect(body).to have_selector('title', text: "#{project.name} issues")
body.should have_selector("entry summary", text: issue.title) expect(body).to have_selector('author email', text: issue.author_email)
expect(body).to have_selector('entry summary', text: issue.title)
end end
end end
context "when authenticated via private token" do context 'when authenticated via private token' do
it "should render atom feed" do it 'should render atom feed' do
visit project_issues_path(project, :atom, private_token: user.private_token) visit project_issues_path(project, :atom,
private_token: user.private_token)
response_headers['Content-Type'].should have_content("application/atom+xml") expect(response_headers['Content-Type']).
body.should have_selector("title", text: "#{project.name} issues") to have_content('application/atom+xml')
body.should have_selector("author email", text: issue.author_email) expect(body).to have_selector('title', text: "#{project.name} issues")
body.should have_selector("entry summary", text: issue.title) expect(body).to have_selector('author email', text: issue.author_email)
expect(body).to have_selector('entry summary', text: issue.title)
end end
end end
end end
......
...@@ -4,17 +4,23 @@ describe "User Feed", feature: true do ...@@ -4,17 +4,23 @@ describe "User Feed", feature: true do
describe "GET /" do describe "GET /" do
let!(:user) { create(:user) } let!(:user) { create(:user) }
context "user atom feed via private token" do context 'user atom feed via private token' do
it "should render user atom feed" do it "should render user atom feed" do
visit user_path(user, :atom, private_token: user.private_token) visit user_path(user, :atom, private_token: user.private_token)
body.should have_selector("feed title") expect(body).to have_selector('feed title')
end end
end end
context 'feed content' do context 'feed content' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:issue) { create(:issue, project: project, author: user, description: '') } let(:issue) do
let(:note) { create(:note, noteable: issue, author: user, note: 'Bug confirmed', project: project) } create(:issue, project: project,
author: user, description: '')
end
let(:note) do
create(:note, noteable: issue, author: user,
note: 'Bug confirmed', project: project)
end
before do before do
project.team << [user, :master] project.team << [user, :master]
...@@ -23,11 +29,11 @@ describe "User Feed", feature: true do ...@@ -23,11 +29,11 @@ describe "User Feed", feature: true do
visit user_path(user, :atom, private_token: user.private_token) visit user_path(user, :atom, private_token: user.private_token)
end end
it "should have issue opened event" do it 'should have issue opened event' do
expect(body).to have_content("#{safe_name} opened issue ##{issue.iid}") expect(body).to have_content("#{safe_name} opened issue ##{issue.iid}")
end end
it "should have issue comment event" do it 'should have issue comment event' do
expect(body). expect(body).
to have_content("#{safe_name} commented on issue ##{issue.iid}") to have_content("#{safe_name} commented on issue ##{issue.iid}")
end end
......
...@@ -25,25 +25,25 @@ describe "GitLab Flavored Markdown", feature: true do ...@@ -25,25 +25,25 @@ describe "GitLab Flavored Markdown", feature: true do
it "should render title in commits#index" do it "should render title in commits#index" do
visit project_commits_path(project, 'master', limit: 1) visit project_commits_path(project, 'master', limit: 1)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
it "should render title in commits#show" do it "should render title in commits#show" do
visit project_commit_path(project, commit) visit project_commit_path(project, commit)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
it "should render description in commits#show" do it "should render description in commits#show" do
visit project_commit_path(project, commit) visit project_commit_path(project, commit)
page.should have_link("@#{fred.username}") expect(page).to have_link("@#{fred.username}")
end end
it "should render title in repositories#branches" do it "should render title in repositories#branches" do
visit project_branches_path(project) visit project_branches_path(project)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
end end
...@@ -64,19 +64,19 @@ describe "GitLab Flavored Markdown", feature: true do ...@@ -64,19 +64,19 @@ describe "GitLab Flavored Markdown", feature: true do
it "should render subject in issues#index" do it "should render subject in issues#index" do
visit project_issues_path(project) visit project_issues_path(project)
page.should have_link("##{@other_issue.iid}") expect(page).to have_link("##{@other_issue.iid}")
end end
it "should render subject in issues#show" do it "should render subject in issues#show" do
visit project_issue_path(project, @issue) visit project_issue_path(project, @issue)
page.should have_link("##{@other_issue.iid}") expect(page).to have_link("##{@other_issue.iid}")
end end
it "should render details in issues#show" do it "should render details in issues#show" do
visit project_issue_path(project, @issue) visit project_issue_path(project, @issue)
page.should have_link("@#{fred.username}") expect(page).to have_link("@#{fred.username}")
end end
end end
...@@ -89,13 +89,13 @@ describe "GitLab Flavored Markdown", feature: true do ...@@ -89,13 +89,13 @@ describe "GitLab Flavored Markdown", feature: true do
it "should render title in merge_requests#index" do it "should render title in merge_requests#index" do
visit project_merge_requests_path(project) visit project_merge_requests_path(project)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
it "should render title in merge_requests#show" do it "should render title in merge_requests#show" do
visit project_merge_request_path(project, @merge_request) visit project_merge_request_path(project, @merge_request)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
end end
...@@ -111,19 +111,19 @@ describe "GitLab Flavored Markdown", feature: true do ...@@ -111,19 +111,19 @@ describe "GitLab Flavored Markdown", feature: true do
it "should render title in milestones#index" do it "should render title in milestones#index" do
visit project_milestones_path(project) visit project_milestones_path(project)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
it "should render title in milestones#show" do it "should render title in milestones#show" do
visit project_milestone_path(project, @milestone) visit project_milestone_path(project, @milestone)
page.should have_link("##{issue.iid}") expect(page).to have_link("##{issue.iid}")
end end
it "should render description in milestones#show" do it "should render description in milestones#show" do
visit project_milestone_path(project, @milestone) visit project_milestone_path(project, @milestone)
page.should have_link("@#{fred.username}") expect(page).to have_link("@#{fred.username}")
end end
end end
end end
...@@ -7,7 +7,7 @@ describe 'Help Pages', feature: true do ...@@ -7,7 +7,7 @@ describe 'Help Pages', feature: true do
end end
it 'replace the variable $your_email with the email of the user' do it 'replace the variable $your_email with the email of the user' do
visit help_page_path(category: 'ssh', file: 'README.md') visit help_page_path(category: 'ssh', file: 'README.md')
page.should have_content("ssh-keygen -t rsa -C \"#{@user.email}\"") expect(page).to have_content("ssh-keygen -t rsa -C \"#{@user.email}\"")
end end
end end
end end
This diff is collapsed.
...@@ -3,10 +3,12 @@ require 'spec_helper' ...@@ -3,10 +3,12 @@ require 'spec_helper'
describe 'Comments' do describe 'Comments' do
include RepoHelpers include RepoHelpers
describe "On a merge request", js: true, feature: true do describe 'On a merge request', js: true, feature: true do
let!(:merge_request) { create(:merge_request) } let!(:merge_request) { create(:merge_request) }
let!(:project) { merge_request.source_project } let!(:project) { merge_request.source_project }
let!(:note) { create(:note_on_merge_request, :with_attachment, project: project) } let!(:note) do
create(:note_on_merge_request, :with_attachment, project: project)
end
before do before do
login_as :admin login_as :admin
...@@ -15,19 +17,20 @@ describe 'Comments' do ...@@ -15,19 +17,20 @@ describe 'Comments' do
subject { page } subject { page }
describe "the note form" do describe 'the note form' do
it 'should be valid' do it 'should be valid' do
should have_css(".js-main-target-form", visible: true, count: 1) is_expected.to have_css('.js-main-target-form', visible: true, count: 1)
find(".js-main-target-form input[type=submit]").value.should == "Add Comment" expect(find('.js-main-target-form input[type=submit]').value).
to eq('Add Comment')
within('.js-main-target-form') do within('.js-main-target-form') do
expect(page).not_to have_link('Cancel') expect(page).not_to have_link('Cancel')
end end
end end
describe "with text" do describe 'with text' do
before do before do
within(".js-main-target-form") do within('.js-main-target-form') do
fill_in "note[note]", with: "This is awesome" fill_in 'note[note]', with: 'This is awesome'
end end
end end
...@@ -40,41 +43,45 @@ describe 'Comments' do ...@@ -40,41 +43,45 @@ describe 'Comments' do
end end
end end
describe "when posting a note" do describe 'when posting a note' do
before do before do
within(".js-main-target-form") do within('.js-main-target-form') do
fill_in "note[note]", with: "This is awsome!" fill_in 'note[note]', with: 'This is awsome!'
find('.js-md-preview-button').click find('.js-md-preview-button').click
click_button "Add Comment" click_button 'Add Comment'
end end
end end
it 'should be added and form reset' do it 'should be added and form reset' do
should have_content("This is awsome!") is_expected.to have_content('This is awsome!')
within('.js-main-target-form') do within('.js-main-target-form') do
expect(page).to have_no_field('note[note]', with: 'This is awesome!') expect(page).to have_no_field('note[note]', with: 'This is awesome!')
expect(page).to have_css('.js-md-preview', visible: :hidden) expect(page).to have_css('.js-md-preview', visible: :hidden)
end end
within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } within('.js-main-target-form') do
is_expected.to have_css('.js-note-text', visible: true)
end
end end
end end
describe "when editing a note", js: true do describe 'when editing a note', js: true do
it "should contain the hidden edit form" do it 'should contain the hidden edit form' do
within("#note_#{note.id}") { should have_css(".note-edit-form", visible: false) } within("#note_#{note.id}") do
is_expected.to have_css('.note-edit-form', visible: false)
end
end end
describe "editing the note" do describe 'editing the note' do
before do before do
find('.note').hover find('.note').hover
find(".js-note-edit").click find(".js-note-edit").click
end end
it "should show the note edit form and hide the note body" do it 'should show the note edit form and hide the note body' do
within("#note_#{note.id}") do within("#note_#{note.id}") do
find(".current-note-edit-form", visible: true).should be_visible expect(find('.current-note-edit-form', visible: true)).to be_visible
find(".note-edit-form", visible: true).should be_visible expect(find('.note-edit-form', visible: true)).to be_visible
find(:css, ".note-text", visible: false).should_not be_visible expect(find(:css, '.note-text', visible: false)).not_to be_visible
end end
end end
...@@ -87,41 +94,43 @@ describe 'Comments' do ...@@ -87,41 +94,43 @@ describe 'Comments' do
#end #end
#end #end
it "appends the edited at time to the note" do it 'appends the edited at time to the note' do
within(".current-note-edit-form") do within('.current-note-edit-form') do
fill_in "note[note]", with: "Some new content" fill_in 'note[note]', with: 'Some new content'
find(".btn-save").click find('.btn-save').click
end end
within("#note_#{note.id}") do within("#note_#{note.id}") do
should have_css(".note_edited_ago") is_expected.to have_css('.note_edited_ago')
find(".note_edited_ago").text.should match(/less than a minute ago/) expect(find('.note_edited_ago').text).
to match(/less than a minute ago/)
end end
end end
end end
describe "deleting an attachment" do describe 'deleting an attachment' do
before do before do
find('.note').hover find('.note').hover
find(".js-note-edit").click find('.js-note-edit').click
end end
it "shows the delete link" do it 'shows the delete link' do
within(".note-attachment") do within('.note-attachment') do
should have_css(".js-note-attachment-delete") is_expected.to have_css('.js-note-attachment-delete')
end end
end end
it "removes the attachment div and resets the edit form" do it 'removes the attachment div and resets the edit form' do
find(".js-note-attachment-delete").click find('.js-note-attachment-delete').click
should_not have_css(".note-attachment") is_expected.not_to have_css('.note-attachment')
find(".current-note-edit-form", visible: false).should_not be_visible expect(find('.current-note-edit-form', visible: false)).
not_to be_visible
end end
end end
end end
end end
describe "On a merge request diff", js: true, feature: true do describe 'On a merge request diff', js: true, feature: true do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:project) { merge_request.source_project } let(:project) { merge_request.source_project }
...@@ -132,69 +141,75 @@ describe 'Comments' do ...@@ -132,69 +141,75 @@ describe 'Comments' do
subject { page } subject { page }
describe "when adding a note" do describe 'when adding a note' do
before do before do
click_diff_line click_diff_line
end end
describe "the notes holder" do describe 'the notes holder' do
it { should have_css(".js-temp-notes-holder") } it { is_expected.to have_css('.js-temp-notes-holder') }
it { within(".js-temp-notes-holder") { should have_css(".new_note") } } it 'has .new_note css class' do
within('.js-temp-notes-holder') do
expect(subject).to have_css('.new_note')
end
end
end end
describe "the note form" do describe 'the note form' do
it "shouldn't add a second form for same row" do it "shouldn't add a second form for same row" do
click_diff_line click_diff_line
should have_css("tr[id='#{line_code}'] + .js-temp-notes-holder form", count: 1) is_expected.
to have_css("tr[id='#{line_code}'] + .js-temp-notes-holder form",
count: 1)
end end
it "should be removed when canceled" do it 'should be removed when canceled' do
within(".diff-file form[rel$='#{line_code}']") do within(".diff-file form[rel$='#{line_code}']") do
find(".js-close-discussion-note-form").trigger("click") find('.js-close-discussion-note-form').trigger('click')
end end
should have_no_css(".js-temp-notes-holder") is_expected.to have_no_css('.js-temp-notes-holder')
end end
end end
end end
describe "with muliple note forms" do describe 'with muliple note forms' do
before do before do
click_diff_line click_diff_line
click_diff_line(line_code_2) click_diff_line(line_code_2)
end end
it { should have_css(".js-temp-notes-holder", count: 2) } it { is_expected.to have_css('.js-temp-notes-holder', count: 2) }
describe "previewing them separately" do describe 'previewing them separately' do
before do before do
# add two separate texts and trigger previews on both # add two separate texts and trigger previews on both
within("tr[id='#{line_code}'] + .js-temp-notes-holder") do within("tr[id='#{line_code}'] + .js-temp-notes-holder") do
fill_in "note[note]", with: "One comment on line 7" fill_in 'note[note]', with: 'One comment on line 7'
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
fill_in "note[note]", with: "Another comment on line 10" fill_in 'note[note]', with: 'Another comment on line 10'
find('.js-md-preview-button').click find('.js-md-preview-button').click
end end
end end
end end
describe "posting a note" do describe 'posting a note' do
before do before do
within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
fill_in "note[note]", with: "Another comment on line 10" fill_in 'note[note]', with: 'Another comment on line 10'
click_button("Add Comment") click_button('Add Comment')
end end
end end
it 'should be added as discussion' do it 'should be added as discussion' do
should have_content("Another comment on line 10") is_expected.to have_content('Another comment on line 10')
should have_css(".notes_holder") is_expected.to have_css('.notes_holder')
should have_css(".notes_holder .note", count: 1) is_expected.to have_css('.notes_holder .note', count: 1)
should have_button('Reply') is_expected.to have_button('Reply')
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe "Profile account page", feature: true do describe 'Profile account page', feature: true do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
login_as :user login_as :user
end end
describe "when signup is enabled" do describe 'when signup is enabled' do
before do before do
ApplicationSetting.any_instance.stub(signup_enabled?: true) ApplicationSetting.any_instance.stub(signup_enabled?: true)
visit profile_account_path visit profile_account_path
end end
it { page.should have_content("Remove account") } it { expect(page).to have_content('Remove account') }
it "should delete the account" do it 'should delete the account' do
expect { click_link "Delete account" }.to change {User.count}.by(-1) expect { click_link 'Delete account' }.to change { User.count }.by(-1)
current_path.should == new_user_session_path expect(current_path).to eq(new_user_session_path)
end end
end end
describe "when signup is disabled" do describe 'when signup is disabled' do
before do before do
ApplicationSetting.any_instance.stub(signup_enabled?: false) ApplicationSetting.any_instance.stub(signup_enabled?: false)
visit profile_account_path visit profile_account_path
end end
it "should not have option to remove account" do it 'should not have option to remove account' do
page.should_not have_content("Remove account") expect(page).not_to have_content('Remove account')
current_path.should == profile_account_path expect(current_path).to eq(profile_account_path)
end end
end end
end end
...@@ -14,7 +14,7 @@ describe "Search", feature: true do ...@@ -14,7 +14,7 @@ describe "Search", feature: true do
end end
it "should show project in search results" do it "should show project in search results" do
page.should have_content @project.name expect(page).to have_content @project.name
end end
end end
...@@ -4,52 +4,52 @@ describe "Dashboard access", feature: true do ...@@ -4,52 +4,52 @@ describe "Dashboard access", feature: true do
describe "GET /dashboard" do describe "GET /dashboard" do
subject { dashboard_path } subject { dashboard_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /dashboard/issues" do describe "GET /dashboard/issues" do
subject { issues_dashboard_path } subject { issues_dashboard_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /dashboard/merge_requests" do describe "GET /dashboard/merge_requests" do
subject { merge_requests_dashboard_path } subject { merge_requests_dashboard_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /dashboard/projects" do describe "GET /dashboard/projects" do
subject { projects_dashboard_path } subject { projects_dashboard_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /help" do describe "GET /help" do
subject { help_path } subject { help_path }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /projects/new" do describe "GET /projects/new" do
it { new_project_path.should be_allowed_for :admin } it { expect(new_project_path).to be_allowed_for :admin }
it { new_project_path.should be_allowed_for :user } it { expect(new_project_path).to be_allowed_for :user }
it { new_project_path.should be_denied_for :visitor } it { expect(new_project_path).to be_denied_for :visitor }
end end
describe "GET /groups/new" do describe "GET /groups/new" do
it { new_group_path.should be_allowed_for :admin } it { expect(new_group_path).to be_allowed_for :admin }
it { new_group_path.should be_allowed_for :user } it { expect(new_group_path).to be_allowed_for :user }
it { new_group_path.should be_denied_for :visitor } it { expect(new_group_path).to be_denied_for :visitor }
end end
end end
...@@ -2,9 +2,9 @@ require 'spec_helper' ...@@ -2,9 +2,9 @@ require 'spec_helper'
describe "Group access", feature: true do describe "Group access", feature: true do
describe "GET /projects/new" do describe "GET /projects/new" do
it { new_group_path.should be_allowed_for :admin } it { expect(new_group_path).to be_allowed_for :admin }
it { new_group_path.should be_allowed_for :user } it { expect(new_group_path).to be_allowed_for :user }
it { new_group_path.should be_denied_for :visitor } it { expect(new_group_path).to be_denied_for :visitor }
end end
describe "Group" do describe "Group" do
...@@ -26,73 +26,73 @@ describe "Group access", feature: true do ...@@ -26,73 +26,73 @@ describe "Group access", feature: true do
describe "GET /groups/:path" do describe "GET /groups/:path" do
subject { group_path(group) } subject { group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/issues" do describe "GET /groups/:path/issues" do
subject { issues_group_path(group) } subject { issues_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/merge_requests" do describe "GET /groups/:path/merge_requests" do
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/members" do describe "GET /groups/:path/members" do
subject { members_group_path(group) } subject { members_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/edit" do describe "GET /groups/:path/edit" do
subject { edit_group_path(group) } subject { edit_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_denied_for master } it { is_expected.to be_denied_for master }
it { should be_denied_for reporter } it { is_expected.to be_denied_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for guest } it { is_expected.to be_denied_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/projects" do describe "GET /groups/:path/projects" do
subject { projects_group_path(group) } subject { projects_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_denied_for master } it { is_expected.to be_denied_for master }
it { should be_denied_for reporter } it { is_expected.to be_denied_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for guest } it { is_expected.to be_denied_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
end end
...@@ -22,61 +22,61 @@ describe "Group with internal project access", feature: true do ...@@ -22,61 +22,61 @@ describe "Group with internal project access", feature: true do
describe "GET /groups/:path" do describe "GET /groups/:path" do
subject { group_path(group) } subject { group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/issues" do describe "GET /groups/:path/issues" do
subject { issues_group_path(group) } subject { issues_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/merge_requests" do describe "GET /groups/:path/merge_requests" do
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/members" do describe "GET /groups/:path/members" do
subject { members_group_path(group) } subject { members_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /groups/:path/edit" do describe "GET /groups/:path/edit" do
subject { edit_group_path(group) } subject { edit_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_denied_for master } it { is_expected.to be_denied_for master }
it { should be_denied_for reporter } it { is_expected.to be_denied_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for guest } it { is_expected.to be_denied_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
end end
...@@ -23,61 +23,61 @@ describe "Group access", feature: true do ...@@ -23,61 +23,61 @@ describe "Group access", feature: true do
describe "GET /groups/:path" do describe "GET /groups/:path" do
subject { group_path(group) } subject { group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/issues" do describe "GET /groups/:path/issues" do
subject { issues_group_path(group) } subject { issues_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/merge_requests" do describe "GET /groups/:path/merge_requests" do
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/members" do describe "GET /groups/:path/members" do
subject { members_group_path(group) } subject { members_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/edit" do describe "GET /groups/:path/edit" do
subject { edit_group_path(group) } subject { edit_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_denied_for master } it { is_expected.to be_denied_for master }
it { should be_denied_for reporter } it { is_expected.to be_denied_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for guest } it { is_expected.to be_denied_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
end end
...@@ -22,61 +22,61 @@ describe "Group with public project access", feature: true do ...@@ -22,61 +22,61 @@ describe "Group with public project access", feature: true do
describe "GET /groups/:path" do describe "GET /groups/:path" do
subject { group_path(group) } subject { group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/issues" do describe "GET /groups/:path/issues" do
subject { issues_group_path(group) } subject { issues_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/merge_requests" do describe "GET /groups/:path/merge_requests" do
subject { merge_requests_group_path(group) } subject { merge_requests_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/members" do describe "GET /groups/:path/members" do
subject { members_group_path(group) } subject { members_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_allowed_for master } it { is_expected.to be_allowed_for master }
it { should be_allowed_for reporter } it { is_expected.to be_allowed_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for guest } it { is_expected.to be_allowed_for guest }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_allowed_for :visitor } it { is_expected.to be_allowed_for :visitor }
end end
describe "GET /groups/:path/edit" do describe "GET /groups/:path/edit" do
subject { edit_group_path(group) } subject { edit_group_path(group) }
it { should be_allowed_for owner } it { is_expected.to be_allowed_for owner }
it { should be_denied_for master } it { is_expected.to be_denied_for master }
it { should be_denied_for reporter } it { is_expected.to be_denied_for reporter }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_denied_for guest } it { is_expected.to be_denied_for guest }
it { should be_denied_for :user } it { is_expected.to be_denied_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
end end
...@@ -7,70 +7,70 @@ describe "Users Security", feature: true do ...@@ -7,70 +7,70 @@ describe "Users Security", feature: true do
end end
describe "GET /login" do describe "GET /login" do
it { new_user_session_path.should_not be_404_for :visitor } it { expect(new_user_session_path).not_to be_404_for :visitor }
end end
describe "GET /profile/keys" do describe "GET /profile/keys" do
subject { profile_keys_path } subject { profile_keys_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile" do describe "GET /profile" do
subject { profile_path } subject { profile_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/account" do describe "GET /profile/account" do
subject { profile_account_path } subject { profile_account_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/design" do describe "GET /profile/design" do
subject { design_profile_path } subject { design_profile_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/history" do describe "GET /profile/history" do
subject { history_profile_path } subject { history_profile_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/notifications" do describe "GET /profile/notifications" do
subject { profile_notifications_path } subject { profile_notifications_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
describe "GET /profile/groups" do describe "GET /profile/groups" do
subject { profile_groups_path } subject { profile_groups_path }
it { should be_allowed_for @u1 } it { is_expected.to be_allowed_for @u1 }
it { should be_allowed_for :admin } it { is_expected.to be_allowed_for :admin }
it { should be_allowed_for :user } it { is_expected.to be_allowed_for :user }
it { should be_denied_for :visitor } it { is_expected.to be_denied_for :visitor }
end end
end end
end end
...@@ -27,40 +27,40 @@ describe IssuesFinder do ...@@ -27,40 +27,40 @@ describe IssuesFinder do
it 'should filter by all' do it 'should filter by all' do
params = { scope: "all", state: 'opened' } params = { scope: "all", state: 'opened' }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.size.should == 3 expect(issues.size).to eq(3)
end end
it 'should filter by assignee id' do it 'should filter by assignee id' do
params = { scope: "all", assignee_id: user.id, state: 'opened' } params = { scope: "all", assignee_id: user.id, state: 'opened' }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.size.should == 2 expect(issues.size).to eq(2)
end end
it 'should filter by author id' do it 'should filter by author id' do
params = { scope: "all", author_id: user2.id, state: 'opened' } params = { scope: "all", author_id: user2.id, state: 'opened' }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.should == [issue3] expect(issues).to eq([issue3])
end end
it 'should filter by milestone id' do it 'should filter by milestone id' do
params = { scope: "all", milestone_id: milestone.id, state: 'opened' } params = { scope: "all", milestone_id: milestone.id, state: 'opened' }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.should == [issue1] expect(issues).to eq([issue1])
end end
it 'should be empty for unauthorized user' do it 'should be empty for unauthorized user' do
params = { scope: "all", state: 'opened' } params = { scope: "all", state: 'opened' }
issues = IssuesFinder.new.execute(nil, params) issues = IssuesFinder.new.execute(nil, params)
issues.size.should be_zero expect(issues.size).to be_zero
end end
it 'should not include unauthorized issues' do it 'should not include unauthorized issues' do
params = { scope: "all", state: 'opened' } params = { scope: "all", state: 'opened' }
issues = IssuesFinder.new.execute(user2, params) issues = IssuesFinder.new.execute(user2, params)
issues.size.should == 2 expect(issues.size).to eq(2)
issues.should_not include(issue1) expect(issues).not_to include(issue1)
issues.should include(issue2) expect(issues).to include(issue2)
issues.should include(issue3) expect(issues).to include(issue3)
end end
end end
...@@ -68,13 +68,13 @@ describe IssuesFinder do ...@@ -68,13 +68,13 @@ describe IssuesFinder do
it 'should filter by assignee' do it 'should filter by assignee' do
params = { scope: "assigned-to-me", state: 'opened' } params = { scope: "assigned-to-me", state: 'opened' }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.size.should == 2 expect(issues.size).to eq(2)
end end
it 'should filter by project' do it 'should filter by project' do
params = { scope: "assigned-to-me", state: 'opened', project_id: project1.id } params = { scope: "assigned-to-me", state: 'opened', project_id: project1.id }
issues = IssuesFinder.new.execute(user, params) issues = IssuesFinder.new.execute(user, params)
issues.size.should == 1 expect(issues.size).to eq(1)
end end
end end
end end
......
...@@ -21,13 +21,13 @@ describe MergeRequestsFinder do ...@@ -21,13 +21,13 @@ describe MergeRequestsFinder do
it 'should filter by scope' do it 'should filter by scope' do
params = { scope: 'authored', state: 'opened' } params = { scope: 'authored', state: 'opened' }
merge_requests = MergeRequestsFinder.new.execute(user, params) merge_requests = MergeRequestsFinder.new.execute(user, params)
merge_requests.size.should == 2 expect(merge_requests.size).to eq(2)
end end
it 'should filter by project' do it 'should filter by project' do
params = { project_id: project1.id, scope: 'authored', state: 'opened' } params = { project_id: project1.id, scope: 'authored', state: 'opened' }
merge_requests = MergeRequestsFinder.new.execute(user, params) merge_requests = MergeRequestsFinder.new.execute(user, params)
merge_requests.size.should == 1 expect(merge_requests.size).to eq(1)
end end
end end
end end
...@@ -21,7 +21,7 @@ describe NotesFinder do ...@@ -21,7 +21,7 @@ describe NotesFinder do
it 'should find all notes' do it 'should find all notes' do
notes = NotesFinder.new.execute(project, user, params) notes = NotesFinder.new.execute(project, user, params)
notes.size.should eq(2) expect(notes.size).to eq(2)
end end
it 'should raise an exception for an invalid target_type' do it 'should raise an exception for an invalid target_type' do
...@@ -32,7 +32,7 @@ describe NotesFinder do ...@@ -32,7 +32,7 @@ describe NotesFinder do
it 'filters out old notes' do it 'filters out old notes' do
note2.update_attribute(:updated_at, 2.hours.ago) note2.update_attribute(:updated_at, 2.hours.ago)
notes = NotesFinder.new.execute(project, user, params) notes = NotesFinder.new.execute(project, user, params)
notes.should eq([note1]) expect(notes).to eq([note1])
end end
end end
end end
...@@ -12,19 +12,19 @@ describe ProjectsFinder do ...@@ -12,19 +12,19 @@ describe ProjectsFinder do
context 'non authenticated' do context 'non authenticated' do
subject { ProjectsFinder.new.execute(nil, group: group) } subject { ProjectsFinder.new.execute(nil, group: group) }
it { should include(project1) } it { is_expected.to include(project1) }
it { should_not include(project2) } it { is_expected.not_to include(project2) }
it { should_not include(project3) } it { is_expected.not_to include(project3) }
it { should_not include(project4) } it { is_expected.not_to include(project4) }
end end
context 'authenticated' do context 'authenticated' do
subject { ProjectsFinder.new.execute(user, group: group) } subject { ProjectsFinder.new.execute(user, group: group) }
it { should include(project1) } it { is_expected.to include(project1) }
it { should include(project2) } it { is_expected.to include(project2) }
it { should_not include(project3) } it { is_expected.not_to include(project3) }
it { should_not include(project4) } it { is_expected.not_to include(project4) }
end end
context 'authenticated, project member' do context 'authenticated, project member' do
...@@ -32,10 +32,10 @@ describe ProjectsFinder do ...@@ -32,10 +32,10 @@ describe ProjectsFinder do
subject { ProjectsFinder.new.execute(user, group: group) } subject { ProjectsFinder.new.execute(user, group: group) }
it { should include(project1) } it { is_expected.to include(project1) }
it { should include(project2) } it { is_expected.to include(project2) }
it { should include(project3) } it { is_expected.to include(project3) }
it { should_not include(project4) } it { is_expected.not_to include(project4) }
end end
context 'authenticated, group member' do context 'authenticated, group member' do
...@@ -43,9 +43,9 @@ describe ProjectsFinder do ...@@ -43,9 +43,9 @@ describe ProjectsFinder do
subject { ProjectsFinder.new.execute(user, group: group) } subject { ProjectsFinder.new.execute(user, group: group) }
it { should include(project1) } it { is_expected.to include(project1) }
it { should include(project2) } it { is_expected.to include(project2) }
it { should include(project3) } it { is_expected.to include(project3) }
it { should include(project4) } it { is_expected.to include(project4) }
end end
end end
...@@ -18,14 +18,14 @@ describe SnippetsFinder do ...@@ -18,14 +18,14 @@ describe SnippetsFinder do
it "returns all private and internal snippets" do it "returns all private and internal snippets" do
snippets = SnippetsFinder.new.execute(user, filter: :all) snippets = SnippetsFinder.new.execute(user, filter: :all)
snippets.should include(@snippet2, @snippet3) expect(snippets).to include(@snippet2, @snippet3)
snippets.should_not include(@snippet1) expect(snippets).not_to include(@snippet1)
end end
it "returns all public snippets" do it "returns all public snippets" do
snippets = SnippetsFinder.new.execute(nil, filter: :all) snippets = SnippetsFinder.new.execute(nil, filter: :all)
snippets.should include(@snippet3) expect(snippets).to include(@snippet3)
snippets.should_not include(@snippet1, @snippet2) expect(snippets).not_to include(@snippet1, @snippet2)
end end
end end
...@@ -38,37 +38,37 @@ describe SnippetsFinder do ...@@ -38,37 +38,37 @@ describe SnippetsFinder do
it "returns all public and internal snippets" do it "returns all public and internal snippets" do
snippets = SnippetsFinder.new.execute(user1, filter: :by_user, user: user) snippets = SnippetsFinder.new.execute(user1, filter: :by_user, user: user)
snippets.should include(@snippet2, @snippet3) expect(snippets).to include(@snippet2, @snippet3)
snippets.should_not include(@snippet1) expect(snippets).not_to include(@snippet1)
end end
it "returns internal snippets" do it "returns internal snippets" do
snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_internal") snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_internal")
snippets.should include(@snippet2) expect(snippets).to include(@snippet2)
snippets.should_not include(@snippet1, @snippet3) expect(snippets).not_to include(@snippet1, @snippet3)
end end
it "returns private snippets" do it "returns private snippets" do
snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_private") snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_private")
snippets.should include(@snippet1) expect(snippets).to include(@snippet1)
snippets.should_not include(@snippet2, @snippet3) expect(snippets).not_to include(@snippet2, @snippet3)
end end
it "returns public snippets" do it "returns public snippets" do
snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_public") snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_public")
snippets.should include(@snippet3) expect(snippets).to include(@snippet3)
snippets.should_not include(@snippet1, @snippet2) expect(snippets).not_to include(@snippet1, @snippet2)
end end
it "returns all snippets" do it "returns all snippets" do
snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user) snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user)
snippets.should include(@snippet1, @snippet2, @snippet3) expect(snippets).to include(@snippet1, @snippet2, @snippet3)
end end
it "returns only public snippets if unauthenticated user" do it "returns only public snippets if unauthenticated user" do
snippets = SnippetsFinder.new.execute(nil, filter: :by_user, user: user) snippets = SnippetsFinder.new.execute(nil, filter: :by_user, user: user)
snippets.should include(@snippet3) expect(snippets).to include(@snippet3)
snippets.should_not include(@snippet2, @snippet1) expect(snippets).not_to include(@snippet2, @snippet1)
end end
end end
...@@ -82,20 +82,20 @@ describe SnippetsFinder do ...@@ -82,20 +82,20 @@ describe SnippetsFinder do
it "returns public snippets for unauthorized user" do it "returns public snippets for unauthorized user" do
snippets = SnippetsFinder.new.execute(nil, filter: :by_project, project: project1) snippets = SnippetsFinder.new.execute(nil, filter: :by_project, project: project1)
snippets.should include(@snippet3) expect(snippets).to include(@snippet3)
snippets.should_not include(@snippet1, @snippet2) expect(snippets).not_to include(@snippet1, @snippet2)
end end
it "returns public and internal snippets for none project members" do it "returns public and internal snippets for none project members" do
snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1)
snippets.should include(@snippet2, @snippet3) expect(snippets).to include(@snippet2, @snippet3)
snippets.should_not include(@snippet1) expect(snippets).not_to include(@snippet1)
end end
it "returns all snippets for project members" do it "returns all snippets for project members" do
project1.team << [user, :developer] project1.team << [user, :developer]
snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1)
snippets.should include(@snippet1, @snippet2, @snippet3) expect(snippets).to include(@snippet1, @snippet2, @snippet3)
end end
end end
end end
...@@ -3,20 +3,20 @@ require 'spec_helper' ...@@ -3,20 +3,20 @@ require 'spec_helper'
describe ApplicationHelper do describe ApplicationHelper do
describe 'current_controller?' do describe 'current_controller?' do
before do before do
controller.stub(:controller_name).and_return('foo') allow(controller).to receive(:controller_name).and_return('foo')
end end
it 'returns true when controller matches argument' do it 'returns true when controller matches argument' do
current_controller?(:foo).should be_true expect(current_controller?(:foo)).to be_truthy
end end
it 'returns false when controller does not match argument' do it 'returns false when controller does not match argument' do
current_controller?(:bar).should_not be_true expect(current_controller?(:bar)).not_to be_truthy
end end
it 'should take any number of arguments' do it 'should take any number of arguments' do
current_controller?(:baz, :bar).should_not be_true expect(current_controller?(:baz, :bar)).not_to be_truthy
current_controller?(:baz, :bar, :foo).should be_true expect(current_controller?(:baz, :bar, :foo)).to be_truthy
end end
end end
...@@ -26,16 +26,16 @@ describe ApplicationHelper do ...@@ -26,16 +26,16 @@ describe ApplicationHelper do
end end
it 'returns true when action matches argument' do it 'returns true when action matches argument' do
current_action?(:foo).should be_true expect(current_action?(:foo)).to be_truthy
end end
it 'returns false when action does not match argument' do it 'returns false when action does not match argument' do
current_action?(:bar).should_not be_true expect(current_action?(:bar)).not_to be_truthy
end end
it 'should take any number of arguments' do it 'should take any number of arguments' do
current_action?(:baz, :bar).should_not be_true expect(current_action?(:baz, :bar)).not_to be_truthy
current_action?(:baz, :bar, :foo).should be_true expect(current_action?(:baz, :bar, :foo)).to be_truthy
end end
end end
...@@ -46,13 +46,14 @@ describe ApplicationHelper do ...@@ -46,13 +46,14 @@ describe ApplicationHelper do
group = create(:group) group = create(:group)
group.avatar = File.open(avatar_file_path) group.avatar = File.open(avatar_file_path)
group.save! group.save!
group_icon(group.path).to_s.should match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png") expect(group_icon(group.path).to_s).
to match("/uploads/group/avatar/#{ group.id }/gitlab_logo.png")
end end
it 'should give default avatar_icon when no avatar is present' do it 'should give default avatar_icon when no avatar is present' do
group = create(:group) group = create(:group)
group.save! group.save!
group_icon(group.path).should match('group_avatar.png') expect(group_icon(group.path)).to match('group_avatar.png')
end end
end end
...@@ -63,17 +64,18 @@ describe ApplicationHelper do ...@@ -63,17 +64,18 @@ describe ApplicationHelper do
project = create(:project) project = create(:project)
project.avatar = File.open(avatar_file_path) project.avatar = File.open(avatar_file_path)
project.save! project.save!
project_icon(project.to_param).to_s.should == expect(project_icon(project.to_param).to_s).to eq(
"<img alt=\"Gitlab logo\" src=\"/uploads/project/avatar/#{ project.id }/gitlab_logo.png\" />" "<img alt=\"Gitlab logo\" src=\"/uploads/project/avatar/#{ project.id }/gitlab_logo.png\" />"
)
end end
it 'should give uploaded icon when present' do it 'should give uploaded icon when present' do
project = create(:project) project = create(:project)
project.save! project.save!
Project.any_instance.stub(:avatar_in_git).and_return(true) allow_any_instance_of(Project).to receive(:avatar_in_git).and_return(true)
project_icon(project.to_param).to_s.should match( expect(project_icon(project.to_param).to_s).to match(
image_tag(project_avatar_path(project))) image_tag(project_avatar_path(project)))
end end
end end
...@@ -85,7 +87,8 @@ describe ApplicationHelper do ...@@ -85,7 +87,8 @@ describe ApplicationHelper do
user = create(:user) user = create(:user)
user.avatar = File.open(avatar_file_path) user.avatar = File.open(avatar_file_path)
user.save! user.save!
avatar_icon(user.email).to_s.should match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png") expect(avatar_icon(user.email).to_s).
to match("/uploads/user/avatar/#{ user.id }/gitlab_logo.png")
end end
it 'should return an url for the avatar with relative url' do it 'should return an url for the avatar with relative url' do
...@@ -95,13 +98,14 @@ describe ApplicationHelper do ...@@ -95,13 +98,14 @@ describe ApplicationHelper do
user = create(:user) user = create(:user)
user.avatar = File.open(avatar_file_path) user.avatar = File.open(avatar_file_path)
user.save! user.save!
avatar_icon(user.email).to_s.should match("/gitlab/uploads/user/avatar/#{ user.id }/gitlab_logo.png") expect(avatar_icon(user.email).to_s).
to match("/gitlab/uploads/user/avatar/#{ user.id }/gitlab_logo.png")
end end
it 'should call gravatar_icon when no avatar is present' do it 'should call gravatar_icon when no avatar is present' do
user = create(:user, email: 'test@example.com') user = create(:user, email: 'test@example.com')
user.save! user.save!
avatar_icon(user.email).to_s.should == 'http://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=40&d=identicon' expect(avatar_icon(user.email).to_s).to eq('http://www.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0?s=40&d=identicon')
end end
end end
...@@ -110,42 +114,47 @@ describe ApplicationHelper do ...@@ -110,42 +114,47 @@ describe ApplicationHelper do
it 'should return a generic avatar path when Gravatar is disabled' do it 'should return a generic avatar path when Gravatar is disabled' do
ApplicationSetting.any_instance.stub(gravatar_enabled?: false) ApplicationSetting.any_instance.stub(gravatar_enabled?: false)
gravatar_icon(user_email).should match('no_avatar.png') expect(gravatar_icon(user_email)).to match('no_avatar.png')
end end
it 'should return a generic avatar path when email is blank' do it 'should return a generic avatar path when email is blank' do
gravatar_icon('').should match('no_avatar.png') expect(gravatar_icon('')).to match('no_avatar.png')
end end
it 'should return default gravatar url' do it 'should return default gravatar url' do
Gitlab.config.gitlab.stub(https: false) Gitlab.config.gitlab.stub(https: false)
gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118') url = 'http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118'
expect(gravatar_icon(user_email)).to match(url)
end end
it 'should use SSL when appropriate' do it 'should use SSL when appropriate' do
Gitlab.config.gitlab.stub(https: true) Gitlab.config.gitlab.stub(https: true)
gravatar_icon(user_email).should match('https://secure.gravatar.com') expect(gravatar_icon(user_email)).to match('https://secure.gravatar.com')
end end
it 'should return custom gravatar path when gravatar_url is set' do it 'should return custom gravatar path when gravatar_url is set' do
allow(self).to receive(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') allow(Gitlab.config.gravatar).
gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' to receive(:plain_url).
and_return('http://example.local/?s=%{size}&hash=%{hash}')
url = 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
expect(gravatar_icon(user_email, 20)).to eq(url)
end end
it 'should accept a custom size' do it 'should accept a custom size' do
allow(self).to receive(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, 64).should match(/\?s=64/) expect(gravatar_icon(user_email, 64)).to match(/\?s=64/)
end end
it 'should use default size when size is wrong' do it 'should use default size when size is wrong' do
allow(self).to receive(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, nil).should match(/\?s=40/) expect(gravatar_icon(user_email, nil)).to match(/\?s=40/)
end end
it 'should be case insensitive' do it 'should be case insensitive' do
allow(self).to receive(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + ' ') expect(gravatar_icon(user_email)).
to eq(gravatar_icon(user_email.upcase + ' '))
end end
end end
...@@ -163,28 +172,30 @@ describe ApplicationHelper do ...@@ -163,28 +172,30 @@ describe ApplicationHelper do
end end
it 'includes a list of branch names' do it 'includes a list of branch names' do
options[0][0].should == 'Branches' expect(options[0][0]).to eq('Branches')
options[0][1].should include('master', 'feature') expect(options[0][1]).to include('master', 'feature')
end end
it 'includes a list of tag names' do it 'includes a list of tag names' do
options[1][0].should == 'Tags' expect(options[1][0]).to eq('Tags')
options[1][1].should include('v1.0.0','v1.1.0') expect(options[1][1]).to include('v1.0.0', 'v1.1.0')
end end
it 'includes a specific commit ref if defined' do it 'includes a specific commit ref if defined' do
# Must be an instance variable # Must be an instance variable
@ref = '2ed06dc41dbb5936af845b87d79e05bbf24c73b8' @ref = '2ed06dc41dbb5936af845b87d79e05bbf24c73b8'
options[2][0].should == 'Commit' expect(options[2][0]).to eq('Commit')
options[2][1].should == [@ref] expect(options[2][1]).to eq([@ref])
end end
it 'sorts tags in a natural order' do it 'sorts tags in a natural order' do
# Stub repository.tag_names to make sure we get some valid testing data # Stub repository.tag_names to make sure we get some valid testing data
expect(@project.repository).to receive(:tag_names).and_return(['v1.0.9', 'v1.0.10', 'v2.0', 'v3.1.4.2', 'v1.0.9a']) expect(@project.repository).to receive(:tag_names).
and_return(['v1.0.9', 'v1.0.10', 'v2.0', 'v3.1.4.2', 'v1.0.9a'])
options[1][1].should == ['v3.1.4.2', 'v2.0', 'v1.0.10', 'v1.0.9a', 'v1.0.9'] expect(options[1][1]).
to eq(['v3.1.4.2', 'v2.0', 'v1.0.10', 'v1.0.9a', 'v1.0.9'])
end end
end end
...@@ -192,7 +203,7 @@ describe ApplicationHelper do ...@@ -192,7 +203,7 @@ describe ApplicationHelper do
context 'with current_user is nil' do context 'with current_user is nil' do
it 'should return a string' do it 'should return a string' do
allow(self).to receive(:current_user).and_return(nil) allow(self).to receive(:current_user).and_return(nil)
user_color_scheme_class.should be_kind_of(String) expect(user_color_scheme_class).to be_kind_of(String)
end end
end end
...@@ -202,7 +213,7 @@ describe ApplicationHelper do ...@@ -202,7 +213,7 @@ describe ApplicationHelper do
it 'should return a string' do it 'should return a string' do
current_user = double(:color_scheme_id => color_scheme_id) current_user = double(:color_scheme_id => color_scheme_id)
allow(self).to receive(:current_user).and_return(current_user) allow(self).to receive(:current_user).and_return(current_user)
user_color_scheme_class.should be_kind_of(String) expect(user_color_scheme_class).to be_kind_of(String)
end end
end end
end end
...@@ -213,17 +224,17 @@ describe ApplicationHelper do ...@@ -213,17 +224,17 @@ describe ApplicationHelper do
let(:a_tag) { '<a href="#">Foo</a>' } let(:a_tag) { '<a href="#">Foo</a>' }
it 'allows the a tag' do it 'allows the a tag' do
simple_sanitize(a_tag).should == a_tag expect(simple_sanitize(a_tag)).to eq(a_tag)
end end
it 'allows the span tag' do it 'allows the span tag' do
input = '<span class="foo">Bar</span>' input = '<span class="foo">Bar</span>'
simple_sanitize(input).should == input expect(simple_sanitize(input)).to eq(input)
end end
it 'disallows other tags' do it 'disallows other tags' do
input = "<strike><b>#{a_tag}</b></strike>" input = "<strike><b>#{a_tag}</b></strike>"
simple_sanitize(input).should == a_tag expect(simple_sanitize(input)).to eq(a_tag)
end end
end end
...@@ -254,7 +265,7 @@ describe ApplicationHelper do ...@@ -254,7 +265,7 @@ describe ApplicationHelper do
let(:content) { 'Noël' } let(:content) { 'Noël' }
it 'should preserve encoding' do it 'should preserve encoding' do
content.encoding.name.should == 'UTF-8' expect(content.encoding.name).to eq('UTF-8')
expect(render_markup('foo.rst', content).encoding.name).to eq('UTF-8') expect(render_markup('foo.rst', content).encoding.name).to eq('UTF-8')
end end
end end
......
...@@ -6,7 +6,7 @@ describe BroadcastMessagesHelper do ...@@ -6,7 +6,7 @@ describe BroadcastMessagesHelper do
context "default style" do context "default style" do
it "should have no style" do it "should have no style" do
broadcast_styling(broadcast_message).should match('') expect(broadcast_styling(broadcast_message)).to match('')
end end
end end
...@@ -14,7 +14,8 @@ describe BroadcastMessagesHelper do ...@@ -14,7 +14,8 @@ describe BroadcastMessagesHelper do
before { broadcast_message.stub(color: "#f2dede", font: "#b94a48") } before { broadcast_message.stub(color: "#f2dede", font: "#b94a48") }
it "should have a customized style" do it "should have a customized style" do
broadcast_styling(broadcast_message).should match('background-color:#f2dede;color:#b94a48') expect(broadcast_styling(broadcast_message)).
to match('background-color:#f2dede;color:#b94a48')
end end
end end
end end
......
...@@ -10,58 +10,61 @@ describe DiffHelper do ...@@ -10,58 +10,61 @@ describe DiffHelper do
describe 'diff_hard_limit_enabled?' do describe 'diff_hard_limit_enabled?' do
it 'should return true if param is provided' do it 'should return true if param is provided' do
controller.stub(:params).and_return { { :force_show_diff => true } } allow(controller).to receive(:params) { { force_show_diff: true } }
diff_hard_limit_enabled?.should be_true expect(diff_hard_limit_enabled?).to be_truthy
end end
it 'should return false if param is not provided' do it 'should return false if param is not provided' do
diff_hard_limit_enabled?.should be_false expect(diff_hard_limit_enabled?).to be_falsey
end end
end end
describe 'allowed_diff_size' do describe 'allowed_diff_size' do
it 'should return hard limit for a diff if force diff is true' do it 'should return hard limit for a diff if force diff is true' do
controller.stub(:params).and_return { { :force_show_diff => true } } allow(controller).to receive(:params) { { force_show_diff: true } }
allowed_diff_size.should eq(1000) expect(allowed_diff_size).to eq(1000)
end end
it 'should return safe limit for a diff if force diff is false' do it 'should return safe limit for a diff if force diff is false' do
allowed_diff_size.should eq(100) expect(allowed_diff_size).to eq(100)
end end
end end
describe 'parallel_diff' do describe 'parallel_diff' do
it 'should return an array of arrays containing the parsed diff' do it 'should return an array of arrays containing the parsed diff' do
parallel_diff(diff_file, 0).should match_array(parallel_diff_result_array) expect(parallel_diff(diff_file, 0)).
to match_array(parallel_diff_result_array)
end end
end end
describe 'generate_line_code' do describe 'generate_line_code' do
it 'should generate correct line code' do it 'should generate correct line code' do
generate_line_code(diff_file.file_path, diff_file.diff_lines.first).should == '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6' expect(generate_line_code(diff_file.file_path, diff_file.diff_lines.first)).
to eq('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6')
end end
end end
describe 'unfold_bottom_class' do describe 'unfold_bottom_class' do
it 'should return empty string when bottom line shouldnt be unfolded' do it 'should return empty string when bottom line shouldnt be unfolded' do
unfold_bottom_class(false).should == '' expect(unfold_bottom_class(false)).to eq('')
end end
it 'should return js class when bottom lines should be unfolded' do it 'should return js class when bottom lines should be unfolded' do
unfold_bottom_class(true).should == 'js-unfold-bottom' expect(unfold_bottom_class(true)).to eq('js-unfold-bottom')
end end
end end
describe 'diff_line_content' do describe 'diff_line_content' do
it 'should return non breaking space when line is empty' do it 'should return non breaking space when line is empty' do
diff_line_content(nil).should eq(" &nbsp;") expect(diff_line_content(nil)).to eq(' &nbsp;')
end end
it 'should return the line itself' do it 'should return the line itself' do
diff_line_content(diff_file.diff_lines.first.text).should eq("@@ -6,12 +6,18 @@ module Popen") expect(diff_line_content(diff_file.diff_lines.first.text)).
diff_line_content(diff_file.diff_lines.first.type).should eq("match") to eq('@@ -6,12 +6,18 @@ module Popen')
diff_line_content(diff_file.diff_lines.first.new_pos).should eq(6) expect(diff_line_content(diff_file.diff_lines.first.type)).to eq('match')
expect(diff_line_content(diff_file.diff_lines.first.new_pos)).to eq(6)
end end
end end
......
This diff is collapsed.
...@@ -5,25 +5,25 @@ describe IssuesHelper do ...@@ -5,25 +5,25 @@ describe IssuesHelper do
let(:issue) { create :issue, project: project } let(:issue) { create :issue, project: project }
let(:ext_project) { create :redmine_project } let(:ext_project) { create :redmine_project }
describe :title_for_issue do describe "title_for_issue" do
it "should return issue title if used internal tracker" do it "should return issue title if used internal tracker" do
@project = project @project = project
title_for_issue(issue.iid).should eq issue.title expect(title_for_issue(issue.iid)).to eq issue.title
end end
it "should always return empty string if used external tracker" do it "should always return empty string if used external tracker" do
@project = ext_project @project = ext_project
title_for_issue(rand(100)).should eq "" expect(title_for_issue(rand(100))).to eq ""
end end
it "should always return empty string if project nil" do it "should always return empty string if project nil" do
@project = nil @project = nil
title_for_issue(rand(100)).should eq "" expect(title_for_issue(rand(100))).to eq ""
end end
end end
describe :url_for_project_issues do describe "url_for_project_issues" do
let(:project_url) { ext_project.external_issue_tracker.project_url } let(:project_url) { ext_project.external_issue_tracker.project_url }
let(:ext_expected) do let(:ext_expected) do
project_url.gsub(':project_id', ext_project.id.to_s) project_url.gsub(':project_id', ext_project.id.to_s)
...@@ -33,34 +33,34 @@ describe IssuesHelper do ...@@ -33,34 +33,34 @@ describe IssuesHelper do
it "should return internal path if used internal tracker" do it "should return internal path if used internal tracker" do
@project = project @project = project
url_for_project_issues.should match(int_expected) expect(url_for_project_issues).to match(int_expected)
end end
it "should return path to external tracker" do it "should return path to external tracker" do
@project = ext_project @project = ext_project
url_for_project_issues.should match(ext_expected) expect(url_for_project_issues).to match(ext_expected)
end end
it "should return empty string if project nil" do it "should return empty string if project nil" do
@project = nil @project = nil
url_for_project_issues.should eq "" expect(url_for_project_issues).to eq ""
end end
describe "when external tracker was enabled and then config removed" do describe "when external tracker was enabled and then config removed" do
before do before do
@project = ext_project @project = ext_project
Gitlab.config.stub(:issues_tracker).and_return(nil) allow(Gitlab.config).to receive(:issues_tracker).and_return(nil)
end end
it "should return path to external tracker" do it "should return path to external tracker" do
url_for_project_issues.should match(ext_expected) expect(url_for_project_issues).to match(ext_expected)
end end
end end
end end
describe :url_for_issue do describe "url_for_issue" do
let(:issues_url) { ext_project.external_issue_tracker.issues_url} let(:issues_url) { ext_project.external_issue_tracker.issues_url}
let(:ext_expected) do let(:ext_expected) do
issues_url.gsub(':id', issue.iid.to_s) issues_url.gsub(':id', issue.iid.to_s)
...@@ -71,34 +71,34 @@ describe IssuesHelper do ...@@ -71,34 +71,34 @@ describe IssuesHelper do
it "should return internal path if used internal tracker" do it "should return internal path if used internal tracker" do
@project = project @project = project
url_for_issue(issue.iid).should match(int_expected) expect(url_for_issue(issue.iid)).to match(int_expected)
end end
it "should return path to external tracker" do it "should return path to external tracker" do
@project = ext_project @project = ext_project
url_for_issue(issue.iid).should match(ext_expected) expect(url_for_issue(issue.iid)).to match(ext_expected)
end end
it "should return empty string if project nil" do it "should return empty string if project nil" do
@project = nil @project = nil
url_for_issue(issue.iid).should eq "" expect(url_for_issue(issue.iid)).to eq ""
end end
describe "when external tracker was enabled and then config removed" do describe "when external tracker was enabled and then config removed" do
before do before do
@project = ext_project @project = ext_project
Gitlab.config.stub(:issues_tracker).and_return(nil) allow(Gitlab.config).to receive(:issues_tracker).and_return(nil)
end end
it "should return external path" do it "should return external path" do
url_for_issue(issue.iid).should match(ext_expected) expect(url_for_issue(issue.iid)).to match(ext_expected)
end end
end end
end end
describe :url_for_new_issue do describe '#url_for_new_issue' do
let(:issues_url) { ext_project.external_issue_tracker.new_issue_url } let(:issues_url) { ext_project.external_issue_tracker.new_issue_url }
let(:ext_expected) do let(:ext_expected) do
issues_url.gsub(':project_id', ext_project.id.to_s) issues_url.gsub(':project_id', ext_project.id.to_s)
...@@ -108,29 +108,29 @@ describe IssuesHelper do ...@@ -108,29 +108,29 @@ describe IssuesHelper do
it "should return internal path if used internal tracker" do it "should return internal path if used internal tracker" do
@project = project @project = project
url_for_new_issue.should match(int_expected) expect(url_for_new_issue).to match(int_expected)
end end
it "should return path to external tracker" do it "should return path to external tracker" do
@project = ext_project @project = ext_project
url_for_new_issue.should match(ext_expected) expect(url_for_new_issue).to match(ext_expected)
end end
it "should return empty string if project nil" do it "should return empty string if project nil" do
@project = nil @project = nil
url_for_new_issue.should eq "" expect(url_for_new_issue).to eq ""
end end
describe "when external tracker was enabled and then config removed" do describe "when external tracker was enabled and then config removed" do
before do before do
@project = ext_project @project = ext_project
Gitlab.config.stub(:issues_tracker).and_return(nil) allow(Gitlab.config).to receive(:issues_tracker).and_return(nil)
end end
it "should return internal path" do it "should return internal path" do
url_for_new_issue.should match(ext_expected) expect(url_for_new_issue).to match(ext_expected)
end end
end end
end end
......
...@@ -7,6 +7,6 @@ describe MergeRequestsHelper do ...@@ -7,6 +7,6 @@ describe MergeRequestsHelper do
[build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)] [build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)]
end end
it { should eq('#1, #2, and #3') } it { is_expected.to eq('#1, #2, and #3') }
end end
end end
...@@ -11,7 +11,7 @@ describe NotificationsHelper do ...@@ -11,7 +11,7 @@ describe NotificationsHelper do
before { notification.stub(disabled?: true) } before { notification.stub(disabled?: true) }
it "has a red icon" do it "has a red icon" do
notification_icon(notification).should match('class="fa fa-volume-off ns-mute"') expect(notification_icon(notification)).to match('class="fa fa-volume-off ns-mute"')
end end
end end
...@@ -19,7 +19,7 @@ describe NotificationsHelper do ...@@ -19,7 +19,7 @@ describe NotificationsHelper do
before { notification.stub(participating?: true) } before { notification.stub(participating?: true) }
it "has a blue icon" do it "has a blue icon" do
notification_icon(notification).should match('class="fa fa-volume-down ns-part"') expect(notification_icon(notification)).to match('class="fa fa-volume-down ns-part"')
end end
end end
...@@ -27,12 +27,12 @@ describe NotificationsHelper do ...@@ -27,12 +27,12 @@ describe NotificationsHelper do
before { notification.stub(watch?: true) } before { notification.stub(watch?: true) }
it "has a green icon" do it "has a green icon" do
notification_icon(notification).should match('class="fa fa-volume-up ns-watch"') expect(notification_icon(notification)).to match('class="fa fa-volume-up ns-watch"')
end end
end end
it "has a blue icon" do it "has a blue icon" do
notification_icon(notification).should match('class="fa fa-circle-o ns-default"') expect(notification_icon(notification)).to match('class="fa fa-circle-o ns-default"')
end end
end end
end end
...@@ -4,17 +4,17 @@ describe OauthHelper do ...@@ -4,17 +4,17 @@ describe OauthHelper do
describe "additional_providers" do describe "additional_providers" do
it 'returns all enabled providers' do it 'returns all enabled providers' do
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :github] } allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :github] }
helper.additional_providers.should include(*[:twitter, :github]) expect(helper.additional_providers).to include(*[:twitter, :github])
end end
it 'does not return ldap provider' do it 'does not return ldap provider' do
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :ldapmain] } allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :ldapmain] }
helper.additional_providers.should include(:twitter) expect(helper.additional_providers).to include(:twitter)
end end
it 'returns empty array' do it 'returns empty array' do
allow(helper).to receive(:enabled_oauth_providers) { [] } allow(helper).to receive(:enabled_oauth_providers) { [] }
helper.additional_providers.should == [] expect(helper.additional_providers).to eq([])
end end
end end
end end
\ No newline at end of file
...@@ -3,9 +3,9 @@ require 'spec_helper' ...@@ -3,9 +3,9 @@ require 'spec_helper'
describe ProjectsHelper do describe ProjectsHelper do
describe "#project_status_css_class" do describe "#project_status_css_class" do
it "returns appropriate class" do it "returns appropriate class" do
project_status_css_class("started").should == "active" expect(project_status_css_class("started")).to eq("active")
project_status_css_class("failed").should == "danger" expect(project_status_css_class("failed")).to eq("danger")
project_status_css_class("finished").should == "success" expect(project_status_css_class("finished")).to eq("success")
end end
end end
end end
...@@ -13,7 +13,7 @@ describe SearchHelper do ...@@ -13,7 +13,7 @@ describe SearchHelper do
end end
it "it returns nil" do it "it returns nil" do
search_autocomplete_opts("q").should be_nil expect(search_autocomplete_opts("q")).to be_nil
end end
end end
...@@ -25,29 +25,29 @@ describe SearchHelper do ...@@ -25,29 +25,29 @@ describe SearchHelper do
end end
it "includes Help sections" do it "includes Help sections" do
search_autocomplete_opts("hel").size.should == 9 expect(search_autocomplete_opts("hel").size).to eq(9)
end end
it "includes default sections" do it "includes default sections" do
search_autocomplete_opts("adm").size.should == 1 expect(search_autocomplete_opts("adm").size).to eq(1)
end end
it "includes the user's groups" do it "includes the user's groups" do
create(:group).add_owner(user) create(:group).add_owner(user)
search_autocomplete_opts("gro").size.should == 1 expect(search_autocomplete_opts("gro").size).to eq(1)
end end
it "includes the user's projects" do it "includes the user's projects" do
project = create(:project, namespace: create(:namespace, owner: user)) project = create(:project, namespace: create(:namespace, owner: user))
search_autocomplete_opts(project.name).size.should == 1 expect(search_autocomplete_opts(project.name).size).to eq(1)
end end
context "with a current project" do context "with a current project" do
before { @project = create(:project) } before { @project = create(:project) }
it "includes project-specific sections" do it "includes project-specific sections" do
search_autocomplete_opts("Files").size.should == 1 expect(search_autocomplete_opts("Files").size).to eq(1)
search_autocomplete_opts("Commits").size.should == 1 expect(search_autocomplete_opts("Commits").size).to eq(1)
end end
end end
end end
......
...@@ -19,28 +19,28 @@ describe SubmoduleHelper do ...@@ -19,28 +19,28 @@ describe SubmoduleHelper do
Gitlab.config.gitlab_shell.stub(ssh_port: 22) # set this just to be sure Gitlab.config.gitlab_shell.stub(ssh_port: 22) # set this just to be sure
Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix)) Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ config.user, '@', config.host, ':gitlab-org/gitlab-ce.git' ].join('')) stub_url([ config.user, '@', config.host, ':gitlab-org/gitlab-ce.git' ].join(''))
submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] expect(submodule_links(submodule_item)).to eq([ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ])
end end
it 'should detect ssh on non-standard port' do it 'should detect ssh on non-standard port' do
Gitlab.config.gitlab_shell.stub(ssh_port: 2222) Gitlab.config.gitlab_shell.stub(ssh_port: 2222)
Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix)) Gitlab.config.gitlab_shell.stub(ssh_path_prefix: Settings.send(:build_gitlab_shell_ssh_path_prefix))
stub_url([ 'ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git' ].join('')) stub_url([ 'ssh://', config.user, '@', config.host, ':2222/gitlab-org/gitlab-ce.git' ].join(''))
submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] expect(submodule_links(submodule_item)).to eq([ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ])
end end
it 'should detect http on standard port' do it 'should detect http on standard port' do
Gitlab.config.gitlab.stub(port: 80) Gitlab.config.gitlab.stub(port: 80)
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url)) Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab-org/gitlab-ce.git' ].join('')) stub_url([ 'http://', config.host, '/gitlab-org/gitlab-ce.git' ].join(''))
submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] expect(submodule_links(submodule_item)).to eq([ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ])
end end
it 'should detect http on non-standard port' do it 'should detect http on non-standard port' do
Gitlab.config.gitlab.stub(port: 3000) Gitlab.config.gitlab.stub(port: 3000)
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url)) Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, ':3000/gitlab-org/gitlab-ce.git' ].join('')) stub_url([ 'http://', config.host, ':3000/gitlab-org/gitlab-ce.git' ].join(''))
submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] expect(submodule_links(submodule_item)).to eq([ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ])
end end
it 'should work with relative_url_root' do it 'should work with relative_url_root' do
...@@ -48,67 +48,67 @@ describe SubmoduleHelper do ...@@ -48,67 +48,67 @@ describe SubmoduleHelper do
Gitlab.config.gitlab.stub(relative_url_root: '/gitlab/root') Gitlab.config.gitlab.stub(relative_url_root: '/gitlab/root')
Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url)) Gitlab.config.gitlab.stub(url: Settings.send(:build_gitlab_url))
stub_url([ 'http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git' ].join('')) stub_url([ 'http://', config.host, '/gitlab/root/gitlab-org/gitlab-ce.git' ].join(''))
submodule_links(submodule_item).should == [ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ] expect(submodule_links(submodule_item)).to eq([ project_path('gitlab-org/gitlab-ce'), project_tree_path('gitlab-org/gitlab-ce', 'hash') ])
end end
end end
context 'submodule on github.com' do context 'submodule on github.com' do
it 'should detect ssh' do it 'should detect ssh' do
stub_url('git@github.com:gitlab-org/gitlab-ce.git') stub_url('git@github.com:gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should detect http' do it 'should detect http' do
stub_url('http://github.com/gitlab-org/gitlab-ce.git') stub_url('http://github.com/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should detect https' do it 'should detect https' do
stub_url('https://github.com/gitlab-org/gitlab-ce.git') stub_url('https://github.com/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://github.com/gitlab-org/gitlab-ce', 'https://github.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should return original with non-standard url' do it 'should return original with non-standard url' do
stub_url('http://github.com/gitlab-org/gitlab-ce') stub_url('http://github.com/gitlab-org/gitlab-ce')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
stub_url('http://github.com/another/gitlab-org/gitlab-ce.git') stub_url('http://github.com/another/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
end end
end end
context 'submodule on gitlab.com' do context 'submodule on gitlab.com' do
it 'should detect ssh' do it 'should detect ssh' do
stub_url('git@gitlab.com:gitlab-org/gitlab-ce.git') stub_url('git@gitlab.com:gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should detect http' do it 'should detect http' do
stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git') stub_url('http://gitlab.com/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should detect https' do it 'should detect https' do
stub_url('https://gitlab.com/gitlab-org/gitlab-ce.git') stub_url('https://gitlab.com/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ] expect(submodule_links(submodule_item)).to eq([ 'https://gitlab.com/gitlab-org/gitlab-ce', 'https://gitlab.com/gitlab-org/gitlab-ce/tree/hash' ])
end end
it 'should return original with non-standard url' do it 'should return original with non-standard url' do
stub_url('http://gitlab.com/gitlab-org/gitlab-ce') stub_url('http://gitlab.com/gitlab-org/gitlab-ce')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git') stub_url('http://gitlab.com/another/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
end end
end end
context 'submodule on unsupported' do context 'submodule on unsupported' do
it 'should return original' do it 'should return original' do
stub_url('http://mygitserver.com/gitlab-org/gitlab-ce') stub_url('http://mygitserver.com/gitlab-org/gitlab-ce')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
stub_url('http://mygitserver.com/gitlab-org/gitlab-ce.git') stub_url('http://mygitserver.com/gitlab-org/gitlab-ce.git')
submodule_links(submodule_item).should == [ repo.submodule_url_for, nil ] expect(submodule_links(submodule_item)).to eq([ repo.submodule_url_for, nil ])
end end
end end
end end
......
...@@ -5,40 +5,40 @@ describe TabHelper do ...@@ -5,40 +5,40 @@ describe TabHelper do
describe 'nav_link' do describe 'nav_link' do
before do before do
controller.stub(:controller_name).and_return('foo') allow(controller).to receive(:controller_name).and_return('foo')
allow(self).to receive(:action_name).and_return('foo') allow(self).to receive(:action_name).and_return('foo')
end end
it "captures block output" do it "captures block output" do
nav_link { "Testing Blocks" }.should match(/Testing Blocks/) expect(nav_link { "Testing Blocks" }).to match(/Testing Blocks/)
end end
it "performs checks on the current controller" do it "performs checks on the current controller" do
nav_link(controller: :foo).should match(/<li class="active">/) expect(nav_link(controller: :foo)).to match(/<li class="active">/)
nav_link(controller: :bar).should_not match(/active/) expect(nav_link(controller: :bar)).not_to match(/active/)
nav_link(controller: [:foo, :bar]).should match(/active/) expect(nav_link(controller: [:foo, :bar])).to match(/active/)
end end
it "performs checks on the current action" do it "performs checks on the current action" do
nav_link(action: :foo).should match(/<li class="active">/) expect(nav_link(action: :foo)).to match(/<li class="active">/)
nav_link(action: :bar).should_not match(/active/) expect(nav_link(action: :bar)).not_to match(/active/)
nav_link(action: [:foo, :bar]).should match(/active/) expect(nav_link(action: [:foo, :bar])).to match(/active/)
end end
it "performs checks on both controller and action when both are present" do it "performs checks on both controller and action when both are present" do
nav_link(controller: :bar, action: :foo).should_not match(/active/) expect(nav_link(controller: :bar, action: :foo)).not_to match(/active/)
nav_link(controller: :foo, action: :bar).should_not match(/active/) expect(nav_link(controller: :foo, action: :bar)).not_to match(/active/)
nav_link(controller: :foo, action: :foo).should match(/active/) expect(nav_link(controller: :foo, action: :foo)).to match(/active/)
end end
it "accepts a path shorthand" do it "accepts a path shorthand" do
nav_link(path: 'foo#bar').should_not match(/active/) expect(nav_link(path: 'foo#bar')).not_to match(/active/)
nav_link(path: 'foo#foo').should match(/active/) expect(nav_link(path: 'foo#foo')).to match(/active/)
end end
it "passes extra html options to the list element" do it "passes extra html options to the list element" do
nav_link(action: :foo, html_options: {class: 'home'}).should match(/<li class="home active">/) expect(nav_link(action: :foo, html_options: {class: 'home'})).to match(/<li class="home active">/)
nav_link(html_options: {class: 'active'}).should match(/<li class="active">/) expect(nav_link(html_options: {class: 'active'})).to match(/<li class="active">/)
end end
end end
end end
...@@ -13,7 +13,7 @@ describe TreeHelper do ...@@ -13,7 +13,7 @@ describe TreeHelper do
let(:tree_item) { double(name: "files", path: "files") } let(:tree_item) { double(name: "files", path: "files") }
it "should return the directory name" do it "should return the directory name" do
flatten_tree(tree_item).should match('files') expect(flatten_tree(tree_item)).to match('files')
end end
end end
...@@ -21,7 +21,7 @@ describe TreeHelper do ...@@ -21,7 +21,7 @@ describe TreeHelper do
let(:tree_item) { double(name: "foo", path: "foo") } let(:tree_item) { double(name: "foo", path: "foo") }
it "should return the flattened path" do it "should return the flattened path" do
flatten_tree(tree_item).should match('foo/bar') expect(flatten_tree(tree_item)).to match('foo/bar')
end end
end end
end end
......
...@@ -6,7 +6,7 @@ describe DisableEmailInterceptor do ...@@ -6,7 +6,7 @@ describe DisableEmailInterceptor do
end end
it 'should not send emails' do it 'should not send emails' do
Gitlab.config.gitlab.stub(:email_enabled).and_return(false) allow(Gitlab.config.gitlab).to receive(:email_enabled).and_return(false)
expect { expect {
deliver_mail deliver_mail
}.not_to change(ActionMailer::Base.deliveries, :count) }.not_to change(ActionMailer::Base.deliveries, :count)
......
...@@ -14,44 +14,46 @@ describe ExtractsPath do ...@@ -14,44 +14,46 @@ describe ExtractsPath do
describe '#extract_ref' do describe '#extract_ref' do
it "returns an empty pair when no @project is set" do it "returns an empty pair when no @project is set" do
@project = nil @project = nil
extract_ref('master/CHANGELOG').should == ['', ''] expect(extract_ref('master/CHANGELOG')).to eq(['', ''])
end end
context "without a path" do context "without a path" do
it "extracts a valid branch" do it "extracts a valid branch" do
extract_ref('master').should == ['master', ''] expect(extract_ref('master')).to eq(['master', ''])
end end
it "extracts a valid tag" do it "extracts a valid tag" do
extract_ref('v2.0.0').should == ['v2.0.0', ''] expect(extract_ref('v2.0.0')).to eq(['v2.0.0', ''])
end end
it "extracts a valid commit ref without a path" do it "extracts a valid commit ref without a path" do
extract_ref('f4b14494ef6abf3d144c28e4af0c20143383e062').should == expect(extract_ref('f4b14494ef6abf3d144c28e4af0c20143383e062')).to eq(
['f4b14494ef6abf3d144c28e4af0c20143383e062', ''] ['f4b14494ef6abf3d144c28e4af0c20143383e062', '']
)
end end
it "falls back to a primitive split for an invalid ref" do it "falls back to a primitive split for an invalid ref" do
extract_ref('stable').should == ['stable', ''] expect(extract_ref('stable')).to eq(['stable', ''])
end end
end end
context "with a path" do context "with a path" do
it "extracts a valid branch" do it "extracts a valid branch" do
extract_ref('foo/bar/baz/CHANGELOG').should == ['foo/bar/baz', 'CHANGELOG'] expect(extract_ref('foo/bar/baz/CHANGELOG')).to eq(['foo/bar/baz', 'CHANGELOG'])
end end
it "extracts a valid tag" do it "extracts a valid tag" do
extract_ref('v2.0.0/CHANGELOG').should == ['v2.0.0', 'CHANGELOG'] expect(extract_ref('v2.0.0/CHANGELOG')).to eq(['v2.0.0', 'CHANGELOG'])
end end
it "extracts a valid commit SHA" do it "extracts a valid commit SHA" do
extract_ref('f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG').should == expect(extract_ref('f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG')).to eq(
['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG'] ['f4b14494ef6abf3d144c28e4af0c20143383e062', 'CHANGELOG']
)
end end
it "falls back to a primitive split for an invalid ref" do it "falls back to a primitive split for an invalid ref" do
extract_ref('stable/CHANGELOG').should == ['stable', 'CHANGELOG'] expect(extract_ref('stable/CHANGELOG')).to eq(['stable', 'CHANGELOG'])
end end
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::GitRefValidator do describe Gitlab::GitRefValidator do
it { Gitlab::GitRefValidator.validate('feature/new').should be_true } it { expect(Gitlab::GitRefValidator.validate('feature/new')).to be_truthy }
it { Gitlab::GitRefValidator.validate('implement_@all').should be_true } it { expect(Gitlab::GitRefValidator.validate('implement_@all')).to be_truthy }
it { Gitlab::GitRefValidator.validate('my_new_feature').should be_true } it { expect(Gitlab::GitRefValidator.validate('my_new_feature')).to be_truthy }
it { Gitlab::GitRefValidator.validate('#1').should be_true } it { expect(Gitlab::GitRefValidator.validate('#1')).to be_truthy }
it { Gitlab::GitRefValidator.validate('feature/~new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/~new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/^new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/^new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/:new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/:new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/?new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/?new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/*new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/*new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/[new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/[new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/new/').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/new/')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature/new.').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature/new.')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature\@{').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature\@{')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature\new').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature\new')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature//new').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature//new')).to be_falsey }
it { Gitlab::GitRefValidator.validate('feature new').should be_false } it { expect(Gitlab::GitRefValidator.validate('feature new')).to be_falsey }
end end
...@@ -8,11 +8,11 @@ describe Gitlab::Shell do ...@@ -8,11 +8,11 @@ describe Gitlab::Shell do
Project.stub(find: project) Project.stub(find: project)
end end
it { should respond_to :add_key } it { is_expected.to respond_to :add_key }
it { should respond_to :remove_key } it { is_expected.to respond_to :remove_key }
it { should respond_to :add_repository } it { is_expected.to respond_to :add_repository }
it { should respond_to :remove_repository } it { is_expected.to respond_to :remove_repository }
it { should respond_to :fork_repository } it { is_expected.to respond_to :fork_repository }
it { gitlab_shell.url_to_repo('diaspora').should == Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git" } it { expect(gitlab_shell.url_to_repo('diaspora')).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git") }
end end
...@@ -9,122 +9,122 @@ describe Gitlab::ClosingIssueExtractor do ...@@ -9,122 +9,122 @@ describe Gitlab::ClosingIssueExtractor do
context 'with a single reference' do context 'with a single reference' do
it do it do
message = "Awesome commit (Closes ##{iid1})" message = "Awesome commit (Closes ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Awesome commit (closes ##{iid1})" message = "Awesome commit (closes ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Closed ##{iid1}" message = "Closed ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "closed ##{iid1}" message = "closed ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Closing ##{iid1}" message = "Closing ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "closing ##{iid1}" message = "closing ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Close ##{iid1}" message = "Close ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "close ##{iid1}" message = "close ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Awesome commit (Fixes ##{iid1})" message = "Awesome commit (Fixes ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Awesome commit (fixes ##{iid1})" message = "Awesome commit (fixes ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Fixed ##{iid1}" message = "Fixed ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "fixed ##{iid1}" message = "fixed ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Fixing ##{iid1}" message = "Fixing ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "fixing ##{iid1}" message = "fixing ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Fix ##{iid1}" message = "Fix ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "fix ##{iid1}" message = "fix ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Awesome commit (Resolves ##{iid1})" message = "Awesome commit (Resolves ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Awesome commit (resolves ##{iid1})" message = "Awesome commit (resolves ##{iid1})"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Resolved ##{iid1}" message = "Resolved ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "resolved ##{iid1}" message = "resolved ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Resolving ##{iid1}" message = "Resolving ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "resolving ##{iid1}" message = "resolving ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "Resolve ##{iid1}" message = "Resolve ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
it do it do
message = "resolve ##{iid1}" message = "resolve ##{iid1}"
subject.closed_by_message_in_project(message, project).should == [issue] expect(subject.closed_by_message_in_project(message, project)).to eq([issue])
end end
end end
...@@ -137,37 +137,37 @@ describe Gitlab::ClosingIssueExtractor do ...@@ -137,37 +137,37 @@ describe Gitlab::ClosingIssueExtractor do
it 'fetches issues in single line message' do it 'fetches issues in single line message' do
message = "Closes ##{iid1} and fix ##{iid2}" message = "Closes ##{iid1} and fix ##{iid2}"
subject.closed_by_message_in_project(message, project). expect(subject.closed_by_message_in_project(message, project)).
should == [issue, other_issue] to eq([issue, other_issue])
end end
it 'fetches comma-separated issues references in single line message' do it 'fetches comma-separated issues references in single line message' do
message = "Closes ##{iid1}, closes ##{iid2}" message = "Closes ##{iid1}, closes ##{iid2}"
subject.closed_by_message_in_project(message, project). expect(subject.closed_by_message_in_project(message, project)).
should == [issue, other_issue] to eq([issue, other_issue])
end end
it 'fetches comma-separated issues numbers in single line message' do it 'fetches comma-separated issues numbers in single line message' do
message = "Closes ##{iid1}, ##{iid2} and ##{iid3}" message = "Closes ##{iid1}, ##{iid2} and ##{iid3}"
subject.closed_by_message_in_project(message, project). expect(subject.closed_by_message_in_project(message, project)).
should == [issue, other_issue, third_issue] to eq([issue, other_issue, third_issue])
end end
it 'fetches issues in multi-line message' do it 'fetches issues in multi-line message' do
message = "Awesome commit (closes ##{iid1})\nAlso fixes ##{iid2}" message = "Awesome commit (closes ##{iid1})\nAlso fixes ##{iid2}"
subject.closed_by_message_in_project(message, project). expect(subject.closed_by_message_in_project(message, project)).
should == [issue, other_issue] to eq([issue, other_issue])
end end
it 'fetches issues in hybrid message' do it 'fetches issues in hybrid message' do
message = "Awesome commit (closes ##{iid1})\n"\ message = "Awesome commit (closes ##{iid1})\n"\
"Also fixing issues ##{iid2}, ##{iid3} and #4" "Also fixing issues ##{iid2}, ##{iid3} and #4"
subject.closed_by_message_in_project(message, project). expect(subject.closed_by_message_in_project(message, project)).
should == [issue, other_issue, third_issue] to eq([issue, other_issue, third_issue])
end end
end end
end end
......
...@@ -11,11 +11,11 @@ describe Gitlab::Diff::File do ...@@ -11,11 +11,11 @@ describe Gitlab::Diff::File do
describe :diff_lines do describe :diff_lines do
let(:diff_lines) { diff_file.diff_lines } let(:diff_lines) { diff_file.diff_lines }
it { diff_lines.size.should == 30 } it { expect(diff_lines.size).to eq(30) }
it { diff_lines.first.should be_kind_of(Gitlab::Diff::Line) } it { expect(diff_lines.first).to be_kind_of(Gitlab::Diff::Line) }
end end
describe :mode_changed? do describe :mode_changed? do
it { diff_file.mode_changed?.should be_false } it { expect(diff_file.mode_changed?).to be_falsey }
end end
end end
...@@ -50,43 +50,43 @@ eos ...@@ -50,43 +50,43 @@ eos
@lines = parser.parse(diff.lines) @lines = parser.parse(diff.lines)
end end
it { @lines.size.should == 30 } it { expect(@lines.size).to eq(30) }
describe 'lines' do describe 'lines' do
describe 'first line' do describe 'first line' do
let(:line) { @lines.first } let(:line) { @lines.first }
it { line.type.should == 'match' } it { expect(line.type).to eq('match') }
it { line.old_pos.should == 6 } it { expect(line.old_pos).to eq(6) }
it { line.new_pos.should == 6 } it { expect(line.new_pos).to eq(6) }
it { line.text.should == '@@ -6,12 +6,18 @@ module Popen' } it { expect(line.text).to eq('@@ -6,12 +6,18 @@ module Popen') }
end end
describe 'removal line' do describe 'removal line' do
let(:line) { @lines[10] } let(:line) { @lines[10] }
it { line.type.should == 'old' } it { expect(line.type).to eq('old') }
it { line.old_pos.should == 14 } it { expect(line.old_pos).to eq(14) }
it { line.new_pos.should == 13 } it { expect(line.new_pos).to eq(13) }
it { line.text.should == '- options = { chdir: path }' } it { expect(line.text).to eq('- options = { chdir: path }') }
end end
describe 'addition line' do describe 'addition line' do
let(:line) { @lines[16] } let(:line) { @lines[16] }
it { line.type.should == 'new' } it { expect(line.type).to eq('new') }
it { line.old_pos.should == 15 } it { expect(line.old_pos).to eq(15) }
it { line.new_pos.should == 18 } it { expect(line.new_pos).to eq(18) }
it { line.text.should == '+ options = {' } it { expect(line.text).to eq('+ options = {') }
end end
describe 'unchanged line' do describe 'unchanged line' do
let(:line) { @lines.last } let(:line) { @lines.last }
it { line.type.should == nil } it { expect(line.type).to eq(nil) }
it { line.old_pos.should == 24 } it { expect(line.old_pos).to eq(24) }
it { line.new_pos.should == 31 } it { expect(line.new_pos).to eq(31) }
it { line.text.should == ' @cmd_output &lt;&lt; stderr.read' } it { expect(line.text).to eq(' @cmd_output &lt;&lt; stderr.read') }
end end
end end
end end
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ describe Gitlab::GitAccessWiki do ...@@ -13,7 +13,7 @@ describe Gitlab::GitAccessWiki do
subject { access.push_access_check(user, project, changes) } subject { access.push_access_check(user, project, changes) }
it { subject.allowed?.should be_true } it { expect(subject.allowed?).to be_truthy }
end end
def changes def changes
......
...@@ -13,13 +13,13 @@ describe Gitlab::Github::ProjectCreator do ...@@ -13,13 +13,13 @@ describe Gitlab::Github::ProjectCreator do
let(:namespace){ create(:namespace) } let(:namespace){ create(:namespace) }
it 'creates project' do it 'creates project' do
Project.any_instance.stub(:add_import_job) allow_any_instance_of(Project).to receive(:add_import_job)
project_creator = Gitlab::Github::ProjectCreator.new(repo, namespace, user) project_creator = Gitlab::Github::ProjectCreator.new(repo, namespace, user)
project_creator.execute project_creator.execute
project = Project.last project = Project.last
project.import_url.should == "https://asdffg@gitlab.com/asd/vim.git" expect(project.import_url).to eq("https://asdffg@gitlab.com/asd/vim.git")
project.visibility_level.should == Gitlab::VisibilityLevel::PRIVATE expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
end end
end end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4,7 +4,7 @@ describe Gitlab::LDAP::Config do ...@@ -4,7 +4,7 @@ describe Gitlab::LDAP::Config do
let(:config) { Gitlab::LDAP::Config.new provider } let(:config) { Gitlab::LDAP::Config.new provider }
let(:provider) { 'ldapmain' } let(:provider) { 'ldapmain' }
describe :initalize do describe '#initalize' do
it 'requires a provider' do it 'requires a provider' do
expect{ Gitlab::LDAP::Config.new }.to raise_error ArgumentError expect{ Gitlab::LDAP::Config.new }.to raise_error ArgumentError
end end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment