Commit 848d7b2a authored by Guilherme Garnier's avatar Guilherme Garnier

Fix rubocop warnings in spec/models

parent 59d0263b
......@@ -27,12 +27,12 @@ describe BroadcastMessage do
end
it "should return nil if time not come" do
broadcast_message = create(:broadcast_message, starts_at: Time.now.tomorrow, ends_at: Time.now + 2.days)
create(:broadcast_message, starts_at: Time.now.tomorrow, ends_at: Time.now + 2.days)
expect(BroadcastMessage.current).to be_nil
end
it "should return nil if time has passed" do
broadcast_message = create(:broadcast_message, starts_at: Time.now - 2.days, ends_at: Time.now.yesterday)
create(:broadcast_message, starts_at: Time.now - 2.days, ends_at: Time.now.yesterday)
expect(BroadcastMessage.current).to be_nil
end
end
......
......@@ -228,13 +228,13 @@ describe Ci::Commit do
it "returns finished_at of latest build" do
build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60
build1 = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120
FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120
expect(commit.finished_at.to_i).to eq(build.finished_at.to_i)
end
it "returns nil if there is no finished build" do
build = FactoryGirl.create :ci_not_started_build, commit: commit
FactoryGirl.create :ci_not_started_build, commit: commit
expect(commit.finished_at).to be_nil
end
......
......@@ -22,7 +22,7 @@ describe ProjectHook do
describe '.push_hooks' do
it 'should return hooks for push events only' do
hook = create(:project_hook, push_events: true)
hook2 = create(:project_hook, push_events: false)
create(:project_hook, push_events: false)
expect(ProjectHook.push_hooks).to eq([hook])
end
end
......@@ -30,7 +30,7 @@ describe ProjectHook do
describe '.tag_push_hooks' do
it 'should return hooks for tag push events only' do
hook = create(:project_hook, tag_push_events: true)
hook2 = create(:project_hook, tag_push_events: false)
create(:project_hook, tag_push_events: false)
expect(ProjectHook.tag_push_hooks).to eq([hook])
end
end
......
......@@ -39,8 +39,6 @@ describe ServiceHook do
end
it "POSTs the data as JSON" do
json = @data.to_json
@service_hook.execute(@data)
expect(WebMock).to have_requested(:post, @service_hook.url).with(
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook' }
......
......@@ -60,8 +60,6 @@ describe ProjectHook do
end
it "POSTs the data as JSON" do
json = @data.to_json
@project_hook.execute(@data, 'push_hooks')
expect(WebMock).to have_requested(:post, @project_hook.url).with(
headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook' }
......
......@@ -111,8 +111,8 @@ describe Milestone do
describe :is_empty? do
before do
issue = create :closed_issue, milestone: milestone
merge_request = create :merge_request, milestone: milestone
create :closed_issue, milestone: milestone
create :merge_request, milestone: milestone
end
it 'Should return total count of issues and merge requests assigned to milestone' do
......@@ -125,7 +125,7 @@ describe Milestone do
milestone = create :milestone
create :closed_issue, milestone: milestone
issue = create :issue
create :issue
end
it 'should be true if milestone active and all nested issues closed' do
......
......@@ -49,7 +49,6 @@ describe GitlabCiService do
let(:push_sample_data) { Gitlab::PushDataBuilder.build_sample(project, user) }
it "calls ci_yaml_file" do
service_hook = double
expect(@service).to receive(:ci_yaml_file).with(push_sample_data[:checkout_sha])
@service.execute(push_sample_data)
......
......@@ -87,7 +87,7 @@ describe HipchatService do
it "should create a push message" do
message = hipchat.send(:create_push_message, push_sample_data)
obj_attr = push_sample_data[:object_attributes]
push_sample_data[:object_attributes]
branch = push_sample_data[:ref].gsub('refs/heads/', '')
expect(message).to include("#{user.name} pushed to branch " \
"<a href=\"#{project.web_url}/commits/#{branch}\">#{branch}</a> of " \
......@@ -107,7 +107,7 @@ describe HipchatService do
it "should create a tag push message" do
message = hipchat.send(:create_push_message, push_sample_data)
obj_attr = push_sample_data[:object_attributes]
push_sample_data[:object_attributes]
expect(message).to eq("#{user.name} pushed new tag " \
"<a href=\"#{project.web_url}/commits/test\">test</a> to " \
"<a href=\"#{project.web_url}\">#{project_name}</a>\n")
......
......@@ -140,7 +140,7 @@ describe Project do
describe 'last_activity_date' do
it 'returns the creation date of the project\'s last event if present' do
last_activity_event = create(:event, project: project)
create(:event, project: project)
expect(project.last_activity_at.to_i).to eq(last_event.created_at.to_i)
end
......
......@@ -231,7 +231,7 @@ describe ProjectWiki do
end
def commit_details
commit = { name: user.name, email: user.email, message: "test commit" }
{ name: user.name, email: user.email, message: "test commit" }
end
def create_page(name, content)
......
......@@ -196,7 +196,7 @@ describe WikiPage do
end
def commit_details
commit = { name: user.name, email: user.email, message: "test commit" }
{ name: user.name, email: user.email, message: "test commit" }
end
def create_page(name, content)
......
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