spec/shoes/swt/text_block_spec.rb in shoes-swt-4.0.0.pre6 vs spec/shoes/swt/text_block_spec.rb in shoes-swt-4.0.0.pre7

- old
+ new

@@ -4,33 +4,35 @@ include_context "swt app" let(:height) { 100 } let(:width) { 200 } let(:margin) { 10 } - let(:dsl) { double("dsl", app: shoes_app, text: "text", - margin_left: 0, margin_right: 0, - margin_top: 0, margin_bottom: 0, - pass_coordinates?: nil).as_null_object } + let(:dsl) do + double("dsl", app: shoes_app, text: "text", margin_left: 0, margin_right: 0, + margin_top: 0, margin_bottom: 0, pass_coordinates?: nil) + .as_null_object + end + subject { Shoes::Swt::TextBlock.new(dsl, swt_app) } it_behaves_like "paintable" it_behaves_like "updating visibility" it_behaves_like "clickable backend" - # reported nil, caused trouble in simple-downloader.rb + # reported nil, caused trouble in simple_downloader.rb it 'initially responds with empty segments' do expect(subject.segments).to be_empty end describe "bounds checking" do it "delegates to segment" do - segment = double() + segment = double subject.segments = [segment] expect(segment).to receive(:in_bounds?) - subject.in_bounds?(1,1) + subject.in_bounds?(1, 1) end end describe "contents alignment" do let(:layout_width) { 100 } @@ -42,11 +44,11 @@ let(:fitter) { double("fitter") } let(:segment) { create_segment } let(:second_segment) { create_segment } - let(:current_position) { Shoes::Slot::CurrentPosition.new(0, 0) } + let(:current_position) { Shoes::Slot::Position.new(0, 0) } before(:each) do allow(::Shoes::Swt::TextBlock::Fitter).to receive(:new) { fitter } allow(fitter).to receive(:fit_it_in).and_return([segment], [second_segment]) end @@ -176,11 +178,11 @@ end end end context "links" do - let(:link) { Shoes::Link.new(shoes_app, ["link"]) } + let(:link) { Shoes::Link.new(shoes_app, ["link"]) } before(:each) do allow(dsl).to receive(:links) { [link] } end @@ -194,10 +196,10 @@ subject.replace("text") end end def create_segment(name = "segment", width = layout_width, - height = layout_height, last_line_height = line_height) + height = layout_height, last_line_height = line_height) bounds = double("bounds", width: width, height: height) double(name, disposed?: false, style_from: nil, width: width, height: height, last_line_width: width, last_line_height: last_line_height, bounds: bounds)