Commit 1d11e28b authored by Marin Jankovski's avatar Marin Jankovski

Update spec per rspec 2.99 requirements.

parent 7d9ef112
......@@ -13,10 +13,10 @@ describe MergeRequestsHelper do
last_commit.stub(:sha) { '12d65c' }
end
describe :ci_build_details_path do
describe 'ci_build_details_path' do
it 'does not include api credentials in a link' do
ci_service.stub(:build_page) { "http://secretuser:secretpass@jenkins.example.com:8888/job/test1/scm/bySHA1/12d65c" }
expect(ci_build_details_path(merge_request)).to_not match("secret")
end
end
end
\ No newline at end of file
end
......@@ -21,12 +21,12 @@ describe OauthHelper do
describe "kerberos_enabled?" do
it 'returns true' do
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :github, :kerberos] }
helper.kerberos_enabled?.should be_true
helper.kerberos_enabled?.should be_truthy
end
it 'returns false' do
allow(helper).to receive(:enabled_oauth_providers) { [:twitter, :ldapmain] }
helper.kerberos_enabled?.should be_false
helper.kerberos_enabled?.should be_falsey
end
end
end
\ No newline at end of file
end
......@@ -27,7 +27,7 @@ describe Gitlab::GitAccess do
before do
@branch = create :protected_branch, project: project
end
it "returns true if user is a master" do
project.team << [user, :master]
expect(Gitlab::GitAccess.can_push_to_branch?(user, project, @branch.name)).to be_truthy
......@@ -48,7 +48,7 @@ describe Gitlab::GitAccess do
before do
@branch = create :protected_branch, project: project, developers_can_push: true
end
it "returns true if user is a master" do
project.team << [user, :master]
expect(Gitlab::GitAccess.can_push_to_branch?(user, project, @branch.name)).to be_truthy
......@@ -234,13 +234,13 @@ describe Gitlab::GitAccess do
describe "pass_git_hooks?" do
describe "author email check" do
it 'returns true' do
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').should be_true
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').should be_truthy
end
it 'returns false' do
project.create_git_hook
project.git_hook.update(commit_message_regex: "@only.com")
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_false
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_falsey
end
end
......@@ -251,12 +251,12 @@ describe Gitlab::GitAccess do
end
it 'returns false for non-member user' do
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_false
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_falsey
end
it 'returns true if committer is a gitlab member' do
create(:user, email: 'dmitriy.zaporozhets@gmail.com')
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_true
access.pass_git_hooks?(user, project, 'refs/heads/master', '6f6d7e7ed', '570e7b2ab').allowed?.should be_truthy
end
end
......@@ -264,13 +264,13 @@ describe Gitlab::GitAccess do
it 'returns false when filename is prohibited' do
project.create_git_hook
project.git_hook.update(file_name_regex: "jpg$")
access.pass_git_hooks?(user, project, 'refs/heads/master', '913c66a37', '33f3729a4').allowed?.should be_false
access.pass_git_hooks?(user, project, 'refs/heads/master', '913c66a37', '33f3729a4').allowed?.should be_falsey
end
it 'returns true if file name is allowed' do
project.create_git_hook
project.git_hook.update(file_name_regex: "exe$")
access.pass_git_hooks?(user, project, 'refs/heads/master', '913c66a37', '33f3729a4').allowed?.should be_true
access.pass_git_hooks?(user, project, 'refs/heads/master', '913c66a37', '33f3729a4').allowed?.should be_truthy
end
end
end
......
......@@ -16,7 +16,7 @@ describe Gitlab::Kerberos::Authentication do
::Krb5Auth::Krb5.any_instance.stub(get_init_creds_password: true)
::Krb5Auth::Krb5.any_instance.stub(get_default_realm: kerberos_realm)
expect(klass.login('gitlab', password)).to be_true
expect(klass.login('gitlab', password)).to be_truthy
end
it "returns false if there is no such user in kerberos" do
......@@ -25,7 +25,7 @@ describe Gitlab::Kerberos::Authentication do
::Krb5Auth::Krb5.any_instance.stub(get_init_creds_password: true)
::Krb5Auth::Krb5.any_instance.stub(get_default_realm: kerberos_realm)
expect(klass.login(kerberos_login, password)).to be_false
expect(klass.login(kerberos_login, password)).to be_falsy
end
end
end
\ No newline at end of file
end
......@@ -213,7 +213,7 @@ objectclass: posixGroup
it "gives the user master access for group 1" do
access.update_ldap_group_links
expect( gitlab_group_1.has_master?(user) ).to be_true
expect( gitlab_group_1.has_master?(user) ).to be_truthy
end
end
......
......@@ -111,11 +111,11 @@ describe 'Gitlab::Satellite::MergeAction' do
it { Gitlab::Satellite::MergeAction.new(
merge_request_fork.author,
merge_request_fork).merge!.should be_true }
merge_request_fork).merge!.should be_truthy }
it { Gitlab::Satellite::MergeAction.new(
merge_request_fork_with_conflict.author,
merge_request_fork_with_conflict).merge!.should be_false }
merge_request_fork_with_conflict).merge!.should be_falsey }
end
context 'between branches' do
......@@ -125,11 +125,11 @@ describe 'Gitlab::Satellite::MergeAction' do
it { Gitlab::Satellite::MergeAction.new(
merge_request.author,
merge_request).merge!.should be_true }
merge_request).merge!.should be_truthy }
it { Gitlab::Satellite::MergeAction.new(
merge_request_with_conflict.author,
merge_request_with_conflict).merge!.should be_false }
merge_request_with_conflict).merge!.should be_falsey }
end
end
end
......
......@@ -4,16 +4,27 @@ describe JiraIssue do
let(:project) { create(:project) }
subject { JiraIssue.new('JIRA-123', project) }
its(:id) { should eq('JIRA-123') }
its(:iid) { should eq('JIRA-123') }
its(:to_s) { should eq('JIRA-123') }
describe 'id' do
subject { super().id }
it { is_expected.to eq('JIRA-123') }
end
describe 'iid' do
subject { super().iid }
it { is_expected.to eq('JIRA-123') }
end
describe 'to_s' do
subject { super().to_s }
it { is_expected.to eq('JIRA-123') }
end
describe :== do
specify { subject.should eq(JiraIssue.new('JIRA-123', project)) }
specify { subject.should_not eq(JiraIssue.new('JIRA-124', project)) }
specify { expect(subject).to eq(JiraIssue.new('JIRA-123', project)) }
specify { expect(subject).not_to eq(JiraIssue.new('JIRA-124', project)) }
it 'only compares with JiraIssues' do
subject.should_not eq('JIRA-123')
expect(subject).not_to eq('JIRA-123')
end
end
end
......@@ -108,7 +108,7 @@ describe User do
end
end
end
describe "non_ldap" do
it "retuns non-ldap user" do
User.delete_all
......@@ -495,20 +495,20 @@ describe User do
it "returns true for exisitng user" do
create :user, email: "bruno@example.com"
expect(User.existing_member?("bruno@example.com")).to be_true
expect(User.existing_member?("bruno@example.com")).to be_truthy
end
it "returns false for unknown exisitng user" do
create :user, email: "bruno@example.com"
expect(User.existing_member?("rendom@example.com")).to be_false
expect(User.existing_member?("rendom@example.com")).to be_falsey
end
it "returns true if additional email exists" do
user = create :user
user.emails.create(email: "bruno@example.com")
expect(User.existing_member?("bruno@example.com")).to be_true
expect(User.existing_member?("bruno@example.com")).to be_truthy
end
end
......
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