Sha256: c94618025ab04e3038b47bd7782723ccb5239b52e3bd86601a82115470919019

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'swt_shoes/spec_helper'

describe Shoes::Swt::Progress do
  include_context "swt app"

  let(:text) { "TEXT" }
  let(:dsl) { double('dsl', app: shoes_app).as_null_object }
  let(:real) { double('real', disposed?: false, :disposed? => false).as_null_object }

  subject { Shoes::Swt::Progress.new dsl, parent }

  before :each do
    parent.stub(:real)
    ::Swt::Widgets::ProgressBar.stub(:new) { real }
  end

  it_behaves_like "movable element"
  it_behaves_like "togglable"

  it "should have a method called fraction=" do
    subject.should respond_to :fraction=
  end

  it "should multiply the value by 100 when calling real.selection" do
    real.should_receive(:selection=).and_return(55)
    subject.fraction = 0.55
  end

  it "should round up correctly" do
    real.should_receive(:selection=).and_return(100)
    subject.fraction = 0.999
  end

  context "with disposed real element" do
    before :each do
      real.stub(:disposed?) { true }
    end

    it "shouldn't set selection" do
      real.should_not_receive(:selection=)
      subject.fraction = 0.55
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/swt_shoes/progress_spec.rb