diff options
Diffstat (limited to 'qa/spec/page/view_spec.rb')
-rw-r--r-- | qa/spec/page/view_spec.rb | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb index d7b3ccd316d..ac33de53a42 100644 --- a/qa/spec/page/view_spec.rb +++ b/qa/spec/page/view_spec.rb @@ -1,69 +1,69 @@ describe QA::Page::View do let(:element) do - double('element', name: :something, pattern: /some element/) + double("element", name: :something, pattern: /some element/) end - subject { described_class.new('some/file.html', [element]) } + subject { described_class.new("some/file.html", [element]) } - describe '.evaluate' do - it 'evaluates a block and returns a DSL object' do - results = described_class.evaluate do + describe ".evaluate" do + it "evaluates a block and returns a DSL object" do + results = described_class.evaluate { element :something element :something_else - end + } expect(results.elements.size).to eq 2 end end - describe '#pathname' do - it 'returns an absolute and clean path to the view' do - expect(subject.pathname.to_s).not_to include 'qa/page/' - expect(subject.pathname.to_s).to include 'some/file.html' + describe "#pathname" do + it "returns an absolute and clean path to the view" do + expect(subject.pathname.to_s).not_to include "qa/page/" + expect(subject.pathname.to_s).to include "some/file.html" end end - describe '#errors' do - context 'when view partial is present' do + describe "#errors" do + context "when view partial is present" do before do allow(subject.pathname).to receive(:readable?) .and_return(true) end - context 'when pattern is found' do + context "when pattern is found" do before do allow(::File).to receive(:foreach) - .and_yield('some element').once + .and_yield("some element").once allow(element).to receive(:matches?) - .with('some element').and_return(true) + .with("some element").and_return(true) end - it 'walks through the view and asserts on elements existence' do + it "walks through the view and asserts on elements existence" do expect(subject.errors).to be_empty end end - context 'when pattern has not been found' do + context "when pattern has not been found" do before do allow(::File).to receive(:foreach) - .and_yield('some element').once + .and_yield("some element").once allow(element).to receive(:matches?) - .with('some element').and_return(false) + .with("some element").and_return(false) end - it 'returns an array of errors related to missing elements' do + it "returns an array of errors related to missing elements" do expect(subject.errors).not_to be_empty expect(subject.errors.first) - .to match %r(Missing element `.*` in `.*/some/file.html` view) + .to match %r{Missing element `.*` in `.*/some/file.html` view} end end end - context 'when view partial has not been found' do - it 'returns an error when it is not able to find the partial' do + context "when view partial has not been found" do + it "returns an error when it is not able to find the partial" do expect(subject.errors).to be_one expect(subject.errors.first) - .to match %r(Missing view partial `.*/some/file.html`!) + .to match %r{Missing view partial `.*/some/file.html`!} end end end |