Skip to content

Commit

Permalink
Specs for Button.text=
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Dec 28, 2015
1 parent cc02e0c commit c37472f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions shoes-core/spec/shoes/button_spec.rb
Expand Up @@ -23,6 +23,7 @@

it { is_expected.to respond_to :click }
it { is_expected.to respond_to :focus }
it { is_expected.to respond_to :text= }

describe "initialize" do
its(:parent) { should eq(parent) }
Expand All @@ -32,6 +33,14 @@
its(:state) { should eq("disabled") }
end

describe ".text=" do
it "changes the text" do
expect(subject.gui).to receive(:text=).with("something else")
subject.text = "something else"
expect(subject.text).to eq "something else"
end
end

describe "relative dimensions" do
subject { Shoes::Button.new(app, parent, "text", relative_opts, input_block) }
it_behaves_like "object with relative dimensions"
Expand Down
1 change: 0 additions & 1 deletion shoes-swt/lib/shoes/swt/button.rb
Expand Up @@ -13,7 +13,6 @@ def initialize(dsl, app)
end

def text=(value)
@last_text = @real.text
@real.text = value
end
end
Expand Down
7 changes: 7 additions & 0 deletions shoes-swt/spec/shoes/swt/button_spec.rb
Expand Up @@ -94,4 +94,11 @@ def with_dimensions_real_should_be(input_width, input_height,
subject.click block
end
end

describe ".text=" do
it "sets text on real element" do
expect(real).to receive(:text=).with("some text")
subject.text = "some text"
end
end
end

0 comments on commit c37472f

Please sign in to comment.