Skip to content

Commit 1e49975

Browse files
committed
Remove mocks from query spec
They weren't needed.
1 parent b90e510 commit 1e49975

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

spec/query_spec.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
context "without client" do
1313
subject { Query.new }
14+
1415
it "should not work" do
1516
expect { subject }.to raise_error(ArgumentError)
1617
end
@@ -34,8 +35,9 @@
3435
let(:query) { Query.new(@client) }
3536

3637
context "with valid pattern" do
37-
before { allow_any_instance_of(Query).to receive(:pattern).and_return("christmas") }
38+
before { query.pattern = "christmas" }
3839
subject { query.url }
40+
3941
it { should include("xmloutputversion=2") }
4042
end
4143

@@ -46,15 +48,17 @@
4648
end
4749

4850
context "with empty pattern" do
49-
before { allow_any_instance_of(Query).to receive(:pattern).and_return("") }
51+
before { query.pattern = "" }
52+
5053
it "raises an error" do
5154
expect { query.url }.to raise_error(RuntimeError, "Missing pattern")
5255
end
5356
end
5457
end
5558

5659
context "with valid pattern" do
57-
before { allow_any_instance_of(Query).to receive(:pattern).and_return("christmas") }
60+
before { subject.pattern = "christmas" }
61+
5862
it "should add language" do
5963
subject.language = "en"
6064
expect(subject.request_parameters).to include(documentlang: 'en')
@@ -77,8 +81,9 @@
7781
end
7882

7983
describe "#pattern" do
84+
before { subject.pattern = "spotify" }
85+
8086
it "should add searchpattern" do
81-
subject.pattern = 'spotify'
8287
expect(subject.url_parameters).to include("searchpattern=spotify")
8388
end
8489
end

0 commit comments

Comments
 (0)