Sha256: fbf86b12fa2d70e51a0985c67a8776ab8625eb0b79381ebbbffd3a7bc07c7b9f
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'swt_shoes/spec_helper' describe Shoes::Swt::Radio do include_context "swt app" let(:text) { "TEXT" } let(:dsl) { double('dsl', :app => shoes_app, :width= => true, :width => 100, :height= => true, :height => 200, :group => nil, :blk => block).as_null_object } let(:block) { proc {} } let(:real) { double('real').as_null_object } subject { Shoes::Swt::Radio.new dsl, parent } before :each do ::Swt::Widgets::Button.stub(:new) { real } end it_behaves_like "buttons" it_behaves_like "movable element" it_behaves_like "selectable" it_behaves_like "togglable" describe "#initialize" do it "sets group to default" do subject.group.should == Shoes::Swt::RadioGroup::DEFAULT_RADIO_GROUP end end describe "#group=" do let(:group_name) { "New Group Name" } let(:radio_group) { double("radio_group").as_null_object } let(:group_lookup) { double('group_lookup', :[] => radio_group).as_null_object } before :each do Shoes::Swt::RadioGroup.stub(:group_lookup) { group_lookup } end it "changes the group" do subject.group = group_name subject.group.should == group_name end it "adds to the new radio group" do group_lookup.should_receive(:[]).with group_name radio_group.should_receive(:add).with subject subject.group = group_name end it "removes from the old radio group" do group_lookup.should_receive(:[]).with Shoes::Swt::RadioGroup::DEFAULT_RADIO_GROUP radio_group.should_receive(:remove).with subject subject.group = group_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-4.0.0.pre1 | spec/swt_shoes/radio_spec.rb |