summaryrefslogtreecommitdiff
path: root/qa/qa/factory/product.rb
blob: df35bbbb443648d9d1044c7a37bbd310f21c9ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'capybara/dsl'

module QA
  module Factory
    class Product
      include Capybara::DSL

      def initialize(factory)
        @factory = factory
        @location = current_url
      end

      def visit!
        visit @location
      end

      def self.populate!(factory)
        raise ArgumentError unless block_given?

        yield factory

        new(factory)
      end
    end
  end
end