Sha256: 0ec8113cbccd5533c46418c32b0c918b6f15278c3abb381007ec4c69245c86f8

Contents?: true

Size: 1.59 KB

Versions: 1

Compression:

Stored size: 1.59 KB

Contents

# encoding: utf-8
require 'jldrill/contexts/GetFilenameContext'
require 'Context/Bridge'
require 'jldrill/views/test/FilenameSelectorView'
require 'jldrill/contexts/MainContext'
require 'jldrill/views/test/MainWindowView'

module JLDrill

	describe GetFilenameContext do

		before(:each) do
			@main = MainContext.new(Context::Bridge.new(JLDrill::Test))
            @main.inTests = true
			@main.createViews
			@context = @main.getFilenameContext
			@context.createViews
			@view = @context.mainView
			
    		def @context.createViews
	    	    # Use the previously set View
    		end

		end
		
        it "should be created by the main context" do
            @main.getFilenameContext.should_not be_nil
        end
        
        it "should immediately exit the context after entering it" do
            @context.should_receive(:exit)
            filename = @context.enter(@main, JLDrill::GetFilenameContext::OPEN)
        end
        
        it "should set the filename and directory from the view" do
            @view.filename = "filename"
            # The context set's the view's directory, but we want to
            # show that when the view's directory is changed it gets
            # updated in the context.  So we rewrite the view's directory
            # method.
            def @view.directory
                "directory"
            end
            filename = @context.enter(@main, JLDrill::GetFilenameContext::OPEN)
            filename.should be_eql("filename")
            @context.filename.should be_eql("filename")
            @context.directory.should be_eql("directory")
        end
        
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 spec/jldrill/contexts/GetFilenameContext_spec.rb