spec/page-object/elements/video_spec.rb in page-object-1.1.1 vs spec/page-object/elements/video_spec.rb in page-object-1.2.0

- old
+ new

@@ -1,27 +1,33 @@ require 'spec_helper' require 'page-object/elements' -describe PageObject::Elements::ListItem do +describe PageObject::Elements::Video do - let(:video) { PageObject::Elements::Video.new(double(''), :platform => :watir_webdriver) } + let(:video) { PageObject::Elements::Video.new(platform, :platform => :watir_webdriver) } + let(:platform) { double('platform')} + let(:wd) { double('wd') } + before do + allow(platform).to receive(:wd).and_return wd + end + it "should return height when present" do - expect(video).to receive(:attribute).with(:height).and_return("20") + expect(wd).to receive(:size).and_return('height' => 20) expect(video.height).to eq(20) end it "should not return height when not present" do - expect(video).to receive(:attribute).with(:height).and_return(nil) + expect(wd).to receive(:size).and_return({}) expect(video.height).to eq(nil) end it "should return width when present" do - expect(video).to receive(:attribute).with(:width).and_return("20") + expect(wd).to receive(:size).and_return('width' => 20) expect(video.width).to eq(20) end it "should not return width when not present" do - expect(video).to receive(:attribute).with(:width).and_return(nil) + expect(wd).to receive(:size).and_return({}) expect(video.width).to eq(nil) end end \ No newline at end of file