Sha256: f9b7aa146a5903f02a1fcdadbeabd7e0ef923f60143e83ce13cb12e99d10d1c5
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
# encoding: utf-8 require 'Context/Spec' require 'Context/View' module Context::Spec::ViewStory describe Context::View do # Since this is an abstract class, we need to override getWidget with # something that does something def overrideGetWidget(view) def view.getWidget @widget end def view.setWidget(widget) @widget = widget end end before(:each) do @context = mock("Context") @view = Context::View.new(@context) @widget = mock("Widget") # Override the getWidget method @view.getWidget.should be_nil overrideGetWidget(@view) @view.setWidget(@widget) @view.getWidget.should be(@widget) end it "should set the context on creation" do @view.context.should be(@context) end it "should use the widgets to add a view" do newView = Context::View.new(@context) overrideGetWidget(newView) newWidget = mock("Widget") newView.setWidget(newWidget) @widget.should_receive(:addToThisWidget).with(newWidget) newWidget.should_receive(:widgetWasAddedTo).with(@widget) @view.addView(newView) end it "should use the widgets to remove a view" do oldView = Context::View.new(@context) overrideGetWidget(oldView) oldWidget = mock("Widget") oldView.setWidget(oldWidget) @widget.should_receive(:removeFromThisWidget).with(oldWidget) oldWidget.should_receive(:widgetWasRemovedFrom).with(@widget) @view.removeView(oldView) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jldrill-0.6.0.1 | spec/Context/View_spec.rb |