summaryrefslogtreecommitdiff
path: root/spec/models/web_hook_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/web_hook_spec.rb')
-rw-r--r--spec/models/web_hook_spec.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/models/web_hook_spec.rb b/spec/models/web_hook_spec.rb
index 100d9a9..735440e 100644
--- a/spec/models/web_hook_spec.rb
+++ b/spec/models/web_hook_spec.rb
@@ -13,22 +13,22 @@ require 'spec_helper'
describe WebHook do
describe "Associations" do
- it { should belong_to :project }
+ it { is_expected.to belong_to :project }
end
describe "Validations" do
- it { should validate_presence_of(:url) }
+ it { is_expected.to validate_presence_of(:url) }
context "url format" do
- it { should allow_value("http://example.com").for(:url) }
- it { should allow_value("https://excample.com").for(:url) }
- it { should allow_value("http://test.com/api").for(:url) }
- it { should allow_value("http://test.com/api?key=abc").for(:url) }
- it { should allow_value("http://test.com/api?key=abc&type=def").for(:url) }
-
- it { should_not allow_value("example.com").for(:url) }
- it { should_not allow_value("ftp://example.com").for(:url) }
- it { should_not allow_value("herp-and-derp").for(:url) }
+ it { is_expected.to allow_value("http://example.com").for(:url) }
+ it { is_expected.to allow_value("https://excample.com").for(:url) }
+ it { is_expected.to allow_value("http://test.com/api").for(:url) }
+ it { is_expected.to allow_value("http://test.com/api?key=abc").for(:url) }
+ it { is_expected.to allow_value("http://test.com/api?key=abc&type=def").for(:url) }
+
+ it { is_expected.not_to allow_value("example.com").for(:url) }
+ it { is_expected.not_to allow_value("ftp://example.com").for(:url) }
+ it { is_expected.not_to allow_value("herp-and-derp").for(:url) }
end
end
@@ -43,18 +43,18 @@ describe WebHook do
it "POSTs to the web hook URL" do
@web_hook.execute(@data)
- WebMock.should have_requested(:post, @web_hook.url).once
+ expect(WebMock).to have_requested(:post, @web_hook.url).once
end
it "POSTs the data as JSON" do
json = @data.to_json
@web_hook.execute(@data)
- WebMock.should have_requested(:post, @web_hook.url).with(body: json).once
+ expect(WebMock).to have_requested(:post, @web_hook.url).with(body: json).once
end
it "catches exceptions" do
- described_class.should_receive(:post).and_raise("Some HTTP Post error")
+ expect(described_class).to receive(:post).and_raise("Some HTTP Post error")
expect { @web_hook.execute(@data) }.
to raise_error(RuntimeError, 'Some HTTP Post error')