Sha256: 8506ef31f8dfa2da242a83cee726e6bb9d0725ebb98f593ac95d07224538d08c

Contents?: true

Size: 629 Bytes

Versions: 10

Compression:

Stored size: 629 Bytes

Contents

module DescribeURI
  def describe_uri(uri, &block)
    describe "with uri: #{uri.inspect}" do
      before { @uri = uri }
      subject { Gitable::URI.parse(@uri) }
      URIChecker.new(self, &block)
    end
  end

  class URIChecker
    def initialize(example_group, &block)
      @example_group = example_group
      instance_eval(&block)
    end

    def it_sets(parts)
      parts.each do |part, value|
        it "sets #{part} to #{value.inspect}" do
          subject.send(part).should == value
        end
      end
    end

    def method_missing(*args, &block)
      @example_group.send(*args, &block)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gitable-0.2.4 spec/describe_uri.rb
gitable-0.2.3 spec/describe_uri.rb
gitable-0.2.2 spec/describe_uri.rb
gitable-0.2.1 spec/describe_uri.rb
gitable-0.2.0 spec/describe_uri.rb
gitable-0.1.3 spec/describe_uri.rb
gitable-0.1.2 spec/describe_uri.rb
gitable-0.1.1 spec/describe_uri.rb
gitable-0.1.0 spec/describe_uri.rb
gitable-0.0.3 spec/describe_uri.rb