Commit 74b995d1 authored by Robert Speicher's avatar Robert Speicher
Browse files

Use `described_class` where appropriate

parent 976bffef
......@@ -3,131 +3,131 @@ require 'spec_helper'
describe Ansi2html do
it "prints non-ansi as-is" do
Ansi2html::convert("Hello").should eq 'Hello'
described_class::convert("Hello").should eq 'Hello'
end
it "strips non-color-changing controll sequences" do
Ansi2html::convert("Hello \e[2Kworld").should eq 'Hello world'
described_class::convert("Hello \e[2Kworld").should eq 'Hello world'
end
it "prints simply red" do
Ansi2html::convert("\e[31mHello\e[0m").should eq '<span class="term-fg-red">Hello</span>'
described_class::convert("\e[31mHello\e[0m").should eq '<span class="term-fg-red">Hello</span>'
end
it "prints simply red without trailing reset" do
Ansi2html::convert("\e[31mHello").should eq '<span class="term-fg-red">Hello</span>'
described_class::convert("\e[31mHello").should eq '<span class="term-fg-red">Hello</span>'
end
it "prints simply yellow" do
Ansi2html::convert("\e[33mHello\e[0m").should eq '<span class="term-fg-yellow">Hello</span>'
described_class::convert("\e[33mHello\e[0m").should eq '<span class="term-fg-yellow">Hello</span>'
end
it "prints default on blue" do
Ansi2html::convert("\e[39;44mHello").should eq '<span class="term-bg-blue">Hello</span>'
described_class::convert("\e[39;44mHello").should eq '<span class="term-bg-blue">Hello</span>'
end
it "prints red on blue" do
Ansi2html::convert("\e[31;44mHello").should eq '<span class="term-fg-red term-bg-blue">Hello</span>'
described_class::convert("\e[31;44mHello").should eq '<span class="term-fg-red term-bg-blue">Hello</span>'
end
it "resets colors after red on blue" do
Ansi2html::convert("\e[31;44mHello\e[0m world").should eq '<span class="term-fg-red term-bg-blue">Hello</span> world'
described_class::convert("\e[31;44mHello\e[0m world").should eq '<span class="term-fg-red term-bg-blue">Hello</span> world'
end
it "performs color change from red/blue to yellow/blue" do
Ansi2html::convert("\e[31;44mHello \e[33mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
described_class::convert("\e[31;44mHello \e[33mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-blue">world</span>'
end
it "performs color change from red/blue to yellow/green" do
Ansi2html::convert("\e[31;44mHello \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
described_class::convert("\e[31;44mHello \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-fg-yellow term-bg-green">world</span>'
end
it "performs color change from red/blue to reset to yellow/green" do
Ansi2html::convert("\e[31;44mHello\e[0m \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
described_class::convert("\e[31;44mHello\e[0m \e[33;42mworld").should eq '<span class="term-fg-red term-bg-blue">Hello</span> <span class="term-fg-yellow term-bg-green">world</span>'
end
it "ignores unsupported codes" do
Ansi2html::convert("\e[51mHello\e[0m").should eq 'Hello'
described_class::convert("\e[51mHello\e[0m").should eq 'Hello'
end
it "prints light red" do
Ansi2html::convert("\e[91mHello\e[0m").should eq '<span class="term-fg-l-red">Hello</span>'
described_class::convert("\e[91mHello\e[0m").should eq '<span class="term-fg-l-red">Hello</span>'
end
it "prints default on light red" do
Ansi2html::convert("\e[101mHello\e[0m").should eq '<span class="term-bg-l-red">Hello</span>'
described_class::convert("\e[101mHello\e[0m").should eq '<span class="term-bg-l-red">Hello</span>'
end
it "performs color change from red/blue to default/blue" do
Ansi2html::convert("\e[31;44mHello \e[39mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
described_class::convert("\e[31;44mHello \e[39mworld").should eq '<span class="term-fg-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end
it "performs color change from light red/blue to default/blue" do
Ansi2html::convert("\e[91;44mHello \e[39mworld").should eq '<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
described_class::convert("\e[91;44mHello \e[39mworld").should eq '<span class="term-fg-l-red term-bg-blue">Hello </span><span class="term-bg-blue">world</span>'
end
it "prints bold text" do
Ansi2html::convert("\e[1mHello").should eq '<span class="term-bold">Hello</span>'
described_class::convert("\e[1mHello").should eq '<span class="term-bold">Hello</span>'
end
it "resets bold text" do
Ansi2html::convert("\e[1mHello\e[21m world").should eq '<span class="term-bold">Hello</span> world'
Ansi2html::convert("\e[1mHello\e[22m world").should eq '<span class="term-bold">Hello</span> world'
described_class::convert("\e[1mHello\e[21m world").should eq '<span class="term-bold">Hello</span> world'
described_class::convert("\e[1mHello\e[22m world").should eq '<span class="term-bold">Hello</span> world'
end
it "prints italic text" do
Ansi2html::convert("\e[3mHello").should eq '<span class="term-italic">Hello</span>'
described_class::convert("\e[3mHello").should eq '<span class="term-italic">Hello</span>'
end
it "resets italic text" do
Ansi2html::convert("\e[3mHello\e[23m world").should eq '<span class="term-italic">Hello</span> world'
described_class::convert("\e[3mHello\e[23m world").should eq '<span class="term-italic">Hello</span> world'
end
it "prints underlined text" do
Ansi2html::convert("\e[4mHello").should eq '<span class="term-underline">Hello</span>'
described_class::convert("\e[4mHello").should eq '<span class="term-underline">Hello</span>'
end
it "resets underlined text" do
Ansi2html::convert("\e[4mHello\e[24m world").should eq '<span class="term-underline">Hello</span> world'
described_class::convert("\e[4mHello\e[24m world").should eq '<span class="term-underline">Hello</span> world'
end
it "prints concealed text" do
Ansi2html::convert("\e[8mHello").should eq '<span class="term-conceal">Hello</span>'
described_class::convert("\e[8mHello").should eq '<span class="term-conceal">Hello</span>'
end
it "resets concealed text" do
Ansi2html::convert("\e[8mHello\e[28m world").should eq '<span class="term-conceal">Hello</span> world'
described_class::convert("\e[8mHello\e[28m world").should eq '<span class="term-conceal">Hello</span> world'
end
it "prints crossed-out text" do
Ansi2html::convert("\e[9mHello").should eq '<span class="term-cross">Hello</span>'
described_class::convert("\e[9mHello").should eq '<span class="term-cross">Hello</span>'
end
it "resets crossed-out text" do
Ansi2html::convert("\e[9mHello\e[29m world").should eq '<span class="term-cross">Hello</span> world'
described_class::convert("\e[9mHello\e[29m world").should eq '<span class="term-cross">Hello</span> world'
end
it "can print 256 xterm fg colors" do
Ansi2html::convert("\e[38;5;16mHello").should eq '<span class="xterm-fg-16">Hello</span>'
described_class::convert("\e[38;5;16mHello").should eq '<span class="xterm-fg-16">Hello</span>'
end
it "can print 256 xterm fg colors on normal magenta background" do
Ansi2html::convert("\e[38;5;16;45mHello").should eq '<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
described_class::convert("\e[38;5;16;45mHello").should eq '<span class="xterm-fg-16 term-bg-magenta">Hello</span>'
end
it "can print 256 xterm bg colors" do
Ansi2html::convert("\e[48;5;240mHello").should eq '<span class="xterm-bg-240">Hello</span>'
described_class::convert("\e[48;5;240mHello").should eq '<span class="xterm-bg-240">Hello</span>'
end
it "can print 256 xterm bg colors on normal magenta foreground" do
Ansi2html::convert("\e[48;5;16;35mHello").should eq '<span class="term-fg-magenta xterm-bg-16">Hello</span>'
described_class::convert("\e[48;5;16;35mHello").should eq '<span class="term-fg-magenta xterm-bg-16">Hello</span>'
end
it "prints bold colored text vividly" do
Ansi2html::convert("\e[1;31mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
described_class::convert("\e[1;31mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
end
it "prints bold light colored text correctly" do
Ansi2html::convert("\e[1;91mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
described_class::convert("\e[1;91mHello\e[0m").should eq '<span class="term-fg-l-red term-bold">Hello</span>'
end
end
require 'spec_helper'
describe "Charts" do
context "build_times" do
before do
@project = FactoryGirl.create(:project)
@commit = FactoryGirl.create(:commit, project: @project)
FactoryGirl.create(:build, commit: @commit)
end
describe Charts::BuildTime do
before do
@project = FactoryGirl.create(:project)
@commit = FactoryGirl.create(:commit, project: @project)
FactoryGirl.create(:build, commit: @commit)
end
it 'should return build times in minutes' do
chart = Charts::BuildTime.new(@project)
chart.build_times.should eq [2]
end
it 'should return build times in minutes' do
chart = described_class.new(@project)
chart.build_times.should eq [2]
end
end
......@@ -11,7 +11,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec"}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1
config_processor.builds_for_stage_and_ref(type, "master").first.should eq({
......@@ -32,7 +32,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec", only: ["deploy"]}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0
end
......@@ -43,7 +43,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec", only: ["/^deploy$/"]}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 0
end
......@@ -54,7 +54,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec", only: ["master"]}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "master").size.should eq 1
end
......@@ -65,7 +65,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec", except: ["tags"]}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "0-1", true).size.should eq 0
end
......@@ -76,7 +76,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec", type: type, only: ["master", "deploy"]}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1
end
......@@ -91,7 +91,7 @@ describe GitlabCiYamlProcessor do
production: {script: "deploy", type: "deploy", only: ["master", "deploy"]},
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref("production", "deploy").size.should eq 0
config_processor.builds_for_stage_and_ref(type, "deploy").size.should eq 1
......@@ -108,7 +108,7 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec"}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({
......@@ -134,7 +134,7 @@ describe GitlabCiYamlProcessor do
rspec: {image: "ruby:2.5", services: ["postgresql"], script: "rspec"}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.builds_for_stage_and_ref("test", "master").size.should eq 1
config_processor.builds_for_stage_and_ref("test", "master").first.should eq({
......@@ -165,147 +165,147 @@ describe GitlabCiYamlProcessor do
rspec: {script: "rspec"}
})
config_processor = GitlabCiYamlProcessor.new(config)
config_processor = described_class.new(config)
config_processor.variables.should eq variables
end
end
describe "Error handling" do
it "indicates that object is invalid" do
expect{GitlabCiYamlProcessor.new("invalid_yaml\n!ccdvlf%612334@@@@")}.to raise_error(GitlabCiYamlProcessor::ValidationError)
expect{described_class.new("invalid_yaml\n!ccdvlf%612334@@@@")}.to raise_error(described_class::ValidationError)
end
it "returns errors if tags parameter is invalid" do
config = YAML.dump({rspec: {script: "test", tags: "mysql"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: tags parameter should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: tags parameter should be an array of strings")
end
it "returns errors if before_script parameter is invalid" do
config = YAML.dump({before_script: "bundle update", rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "before_script should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "before_script should be an array of strings")
end
it "returns errors if image parameter is invalid" do
config = YAML.dump({image: ["test"], rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "image should be a string")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "image should be a string")
end
it "returns errors if job image parameter is invalid" do
config = YAML.dump({rspec: {script: "test", image: ["test"]}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: image should be a string")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: image should be a string")
end
it "returns errors if services parameter is not an array" do
config = YAML.dump({services: "test", rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "services should be an array of strings")
end
it "returns errors if services parameter is not an array of strings" do
config = YAML.dump({services: [10, "test"], rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "services should be an array of strings")
end
it "returns errors if job services parameter is not an array" do
config = YAML.dump({rspec: {script: "test", services: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: services should be an array of strings")
end
it "returns errors if job services parameter is not an array of strings" do
config = YAML.dump({rspec: {script: "test", services: [10, "test"]}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: services should be an array of strings")
end
it "returns errors if there are unknown parameters" do
config = YAML.dump({extra: "bundle update"})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "Unknown parameter: extra")
end
it "returns errors if there are unknown parameters that are hashes, but doesn't have a script" do
config = YAML.dump({extra: {services: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "Unknown parameter: extra")
end
it "returns errors if there is no any jobs defined" do
config = YAML.dump({before_script: ["bundle update"]})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Please define at least one job")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "Please define at least one job")
end
it "returns errors if job allow_failure parameter is not an boolean" do
config = YAML.dump({rspec: {script: "test", allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: allow_failure parameter should be an boolean")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: allow_failure parameter should be an boolean")
end
it "returns errors if job stage is not a string" do
config = YAML.dump({rspec: {script: "test", type: 1, allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end
it "returns errors if job stage is not a pre-defined stage" do
config = YAML.dump({rspec: {script: "test", type: "acceptance", allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end
it "returns errors if job stage is not a defined stage" do
config = YAML.dump({types: ["build", "test"], rspec: {script: "test", type: "acceptance", allow_failure: "string"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "rspec job: stage parameter should be build, test")
end
it "returns errors if stages is not an array" do
config = YAML.dump({types: "test", rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "stages should be an array of strings")
end
it "returns errors if stages is not an array of strings" do
config = YAML.dump({types: [true, "test"], rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "stages should be an array of strings")
end
it "returns errors if variables is not a map" do
config = YAML.dump({variables: "test", rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "variables should be a map of key-valued strings")
end
it "returns errors if variables is not a map of key-valued strings" do
config = YAML.dump({variables: {test: false}, rspec: {script: "test"}})
expect do
GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings")
described_class.new(config)
end.to raise_error(described_class::ValidationError, "variables should be a map of key-valued strings")
end
end
end
require 'spec_helper'
describe Upgrader do
let(:upgrader) { Upgrader.new }
let(:upgrader) { described_class.new }
let(:current_version) { GitlabCi::VERSION }
describe 'current_version_raw' do
......
......@@ -11,7 +11,7 @@ describe Notify do
end
describe 'build success' do
subject { Notify.build_success_email(@build.id, 'wow@example.com') }
subject { described_class.build_success_email(@build.id, 'wow@example.com') }
it 'has the correct subject' do
should have_subject /Build success for/
......@@ -23,7 +23,7 @@ describe Notify do
end
describe 'build fail' do
subject { Notify.build_fail_email(@build.id, 'wow@example.com') }
subject { described_class.build_fail_email(@build.id, 'wow@example.com') }
it 'has the correct subject' do
should have_subject /Build failed for/
......
......@@ -28,7 +28,7 @@ describe MailService do
end
describe 'Sends email for' do
let(:mail) { MailService.new }
let(:mail) { described_class.new }
describe 'failed build' do
let(:project) { FactoryGirl.create(:project, email_add_pusher: true) }
......
require 'spec_helper'
describe Network do
let(:network) { Network.new }
let(:network) { described_class.new }
describe '#enable_ci' do
subject { network.enable_ci '', '', '' }
......
require 'spec_helper'
describe HipChatMessage do
subject { HipChatMessage.new(build) }
subject { described_class.new(build) }
let(:project) { FactoryGirl.create(:project) }
......
......@@ -32,7 +32,7 @@ describe HipChatService do
describe "Execute" do
let(:service) { HipChatService.new }
let(:service) { described_class.new }
let(:project) { FactoryGirl.create :project }
let(:commit) { FactoryGirl.create :commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit, status: 'failed' }
......
require 'spec_helper'
describe SlackMessage do
subject { SlackMessage.new(commit) }
subject { described_class.new(commit) }
let(:project) { FactoryGirl.create :project }
......
......@@ -30,7 +30,7 @@ describe SlackService do
end
describe "Execute" do
let(:slack) { SlackService.new }
let(:slack) { described_class.new }
let(:project) { FactoryGirl.create :project }
let(:commit) { FactoryGirl.create :commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit, status: 'failed' }
......
......@@ -57,7 +57,7 @@ describe Project do
FactoryGirl.create :commit, committed_at: 1.hour.ago, project: newest_project
FactoryGirl.create :commit, committed_at: 2.hour.ago, project: oldest_project
Project.ordered_by_last_commit_date.should eq [newest_project, oldest_project, project_without_commits]
described_class.ordered_by_last_commit_date.should eq [newest_project, oldest_project, project_without_commits]
end
end
......@@ -123,19 +123,19 @@ describe Project do
}
end
describe 'Project.parse' do
describe '.parse' do
let(:project_dump) { YAML.load File.read(Rails.root.join('spec/support/gitlab_stubs/raw_project.yml')) }
let(:parsed_project) { Project.parse(project_dump) }
let(:parsed_project) { described_class.parse(project_dump) }
it { parsed_project.should be_valid }
it { parsed_project.should be_kind_of(Project) }
it { parsed_project.should be_kind_of(described_class) }
it { parsed_project.name.should eq("GitLab / api.gitlab.org") }
it { parsed_project.gitlab_id.should eq(189) }
it { parsed_project.gitlab_url.should eq("http://demo.gitlab.com/gitlab/api-gitlab-org") }
it "parses plain hash" do
Project.parse(project_dump).name.should eq("GitLab / api.gitlab.org")
described_class.parse(project_dump).name.should eq("GitLab / api.gitlab.org")
end
end
......@@ -154,8 +154,8 @@ describe Project do
describe '.search' do
let!(:project) { FactoryGirl.create(:project, name: "foo")