Sha256: 7d39ed8522a7b293913fd7f288daab24a855a04e18ca7940e51008fe4ab6fae1

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 Bytes

Contents

module Spec
  module Story
    class StoryBuilder
      def initialize
        @title = 'a story'
        @narrative = 'narrative'
      end

      def title(value)
        @title = value
        self
      end

      def narrative(value)
        @narrative = value
        self
      end

      def to_story(&block)
        block = lambda {} unless block_given?
        Story.new @title, @narrative, &block
      end
    end

    class ScenarioBuilder
      def initialize
        @name = 'a scenario'
        @story = StoryBuilder.new.to_story
      end

      def name(value)
        @name = value
        self
      end

      def story(value)
        @story = value
        self
      end

      def to_scenario(&block)
        Scenario.new @story, @name, &block
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.1.6 rails_plugins/rspec/spec/spec/story/builders.rb
picolena-0.1.7 rails_plugins/rspec/spec/spec/story/builders.rb
picolena-0.1.8 rails_plugins/rspec/spec/spec/story/builders.rb