Sha256: 0b6625e292dedd54b1499f6a511f21a9114c60bb12578be01c908a98bbb208ad

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

# STUB!
def add_service(arg)  
end

describe "Conditional" do
  it "not fail when calling case_of" do
    lambda {
      case_of "b" do
      end
    }.should_not raise_error
  end
  it "should put the case object on the case stack as a Conditional object" do
    c = case_of "b" do
    end
    c.attribute.should == "b"
  end
  it "should populate the when_statements when a when_is is called" do
    c = case_of "b" do
      when_is "b" do
      end
    end
    c.when_statements.size.should == 1
  end
  it "freeze the case statement when calling end_of" do
    c = case_of "b" do
      when_is "b" do
      end
    end
    c.options.frozen?.should == true
  end
  it "create a new service for the when_is block" do
    c = case_of "b" do
      when_is "b" do
        "I'm TOTALLY B!"
      end
    end
    c.when_statements[:b].is_a?(Service).should == true
  end
  it "create a new service for the when_is block" do
    c = case_of "b" do
      when_is "b" do
        "I'm TOTALLY B!"
      end
      when_is "c" do
        "You are not 'c', don't lie!"
      end
    end
    c.when_statements[:b].is_a?(Service).should == true
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
auser-poolparty-1.1.1 spec/poolparty/services/conditional_spec.rb
auser-poolparty-1.1.3 spec/poolparty/services/conditional_spec.rb
auser-poolparty-1.1.4 spec/poolparty/services/conditional_spec.rb
auser-poolparty-1.1.5 spec/poolparty/services/conditional_spec.rb
auser-poolparty-1.1.6 spec/poolparty/services/conditional_spec.rb
auser-poolparty-1.1.7 spec/poolparty/services/conditional_spec.rb
fairchild-poolparty-1.1.3 spec/poolparty/services/conditional_spec.rb
fairchild-poolparty-1.1.4 spec/poolparty/services/conditional_spec.rb
fairchild-poolparty-1.1.5 spec/poolparty/services/conditional_spec.rb