spec/gitlab/client/pipeline_triggers_spec.rb in gitlab-4.2.0 vs spec/gitlab/client/pipeline_triggers_spec.rb in gitlab-4.3.0

- old
+ new

@@ -1,21 +1,21 @@ require 'spec_helper' describe Gitlab::Client do - it { should respond_to :delete_trigger } + it { is_expected.to respond_to :delete_trigger } describe ".triggers" do before do stub_get("/projects/3/triggers", "triggers") @triggers = Gitlab.triggers(3) end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_get("/projects/3/triggers")).to have_been_made end - it "should return an array of project's triggers" do + it "returns an array of project's triggers" do expect(@triggers).to be_a Gitlab::PaginatedResponse expect(@triggers.first.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") end end @@ -23,15 +23,15 @@ before do stub_get("/projects/3/triggers/10", "trigger") @trigger = Gitlab.trigger(3, 10) end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_get("/projects/3/triggers/10")).to have_been_made end - it "should return information about a trigger" do + it "returns information about a trigger" do expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") end end @@ -39,16 +39,16 @@ before do stub_post("/projects/3/triggers", "trigger") @trigger = Gitlab.create_trigger(3, "my description") end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_post("/projects/3/triggers"). with(body: { description: "my description" })).to have_been_made end - it "should return information about a new trigger" do + it "returns information about a new trigger" do expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") end end @@ -56,16 +56,16 @@ before do stub_put("/projects/3/triggers/1", "trigger") @trigger = Gitlab.update_trigger(3, 1, description: "my description") end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_put("/projects/3/triggers/1"). with(body: { description: "my description" })).to have_been_made end - it "should return information about the trigger" do + it "returns information about the trigger" do expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") end end @@ -73,15 +73,15 @@ before do stub_post("/projects/3/triggers/1/take_ownership", "trigger") @trigger = Gitlab.trigger_take_ownership(3, 1) end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_post("/projects/3/triggers/1/take_ownership")).to have_been_made end - it "should return information about the trigger" do + it "returns information about the trigger" do expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z") expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7") end end @@ -89,11 +89,11 @@ before do stub_delete("/projects/3/triggers/10", "empty") @trigger = Gitlab.remove_trigger(3, 10) end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_delete("/projects/3/triggers/10")).to have_been_made end end describe ".run_trigger" do @@ -105,11 +105,11 @@ context "when private_token is not set" do before do Gitlab.private_token = nil end - it "should not raise Error::MissingCredentials" do + it "does not raise Error::MissingCredentials" do expect { Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) }.to_not raise_error end after do Gitlab.private_token = 'secret' @@ -119,37 +119,37 @@ context "without variables" do before do @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master") end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline"). with(body: { token: "7b9148c158980bbd9bcea92c17522d", ref: "master" })).to have_been_made end - it "should return information about the triggered build" do + it "returns information about the triggered build" do expect(@trigger.id).to eq(8) end end context "with variables" do before do @trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) end - it "should get the correct resource" do + it "gets the correct resource" do expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline"). with(body: { token: "7b9148c158980bbd9bcea92c17522d", ref: "master", variables: {a: "10"} })).to have_been_made end - it "should return information about the triggered build" do + it "returns information about the triggered build" do expect(@trigger.id).to eq(8) expect(@trigger.variables.a).to eq("10") end end end