This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Running all features | |
| Using the default profile... | |
| Disabling profiles... | |
| Feature: Create a VariantDatasheet | |
| In order to make it simple to create hundreds of product variants | |
| An admin | |
| I want to be able to create new VariantDatasheets that contain the info | |
| used to programmatically generate a product's variants |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% content_for :sub_menu do %> | |
| <ul id="sub_nav" data-hook="admin_product_sub_tabs"> | |
| <%= tab :products, :match_path => '/products' %> | |
| <%= tab :option_types, :match_path => '/option_types' %> | |
| <%= tab :properties %> | |
| <%= tab :prototypes %> | |
| <%= tab :product_groups, :match_path => '/product_groups' %> | |
| <%= tab :variant_datasheets, :match_path => '/variant_datasheets', :css_class => 'last' %> | |
| </ul> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ENV['RACK_ENV'] = 'test' | |
| require File.join(File.dirname(__FILE__), '..', '..', 'app.rb') | |
| require 'capybara' | |
| require 'capybara/cucumber' | |
| require 'rspec' | |
| Capybara.app = App |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Unable to find xpath .//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][((./@id = 'textarea' or ./@name = 'textarea') or ./@id = //label[normalize-space(string(.)) = 'textarea']/@for)] | .//label[normalize-space(string(.)) = 'textarea']//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')] | .//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')][((./@id = 'textarea' or ./@name = 'textarea') or ./@id = //label[contains(normalize-space(string(.)), 'textarea')]/@for)] | .//label[contains(normalize-space(string(.)), 'textarea')]//.//*[self::input | self::textarea | self::select][not(./@type = 'submit' or ./@type = 'image' or ./@type = 'hidden')] (Capybara::ElementNotFound) | |
| (eval):2:in `find_field' | |
| ./features/step_definitions/web_steps.rb:151:in `block (2 levels) in <top (required)>' | |
| ./features/step_definitions/web_steps.r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # post.rb | |
| class Post | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :title, String, :required => true | |
| property :body, Text, :required => true | |
| property :slug, String | |
| before :save, :make_slug |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'factory_girl' | |
| FactoryGirl.define do | |
| factory :post do | |
| title "Sample Post" | |
| body "This is the body of a well known sample post." | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Product | |
| include DataMapper::Resource | |
| property :id, Serial | |
| property :title, String, :required => true | |
| property :description, Text, :required => true | |
| has n, :variants | |
| after :create, :make_master_variant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class App | |
| namespace '/admin/products' do | |
| get do | |
| @products = Product.all | |
| haml :'admin/products/index', :layout => :'admin/layout' | |
| end | |
| get '/new' do | |
| @product = Product.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| post '/:id/interactions' do |id| | |
| @screenshot = Screenshot.get(id) | |
| @interaction = @screenshot.interactions.new(params[:interaction]) | |
| if @screenshot.save | |
| flash[:info] = "The new interaction was added to your screenshot!" | |
| redirect '/screenshots/' + id.to_s + '/edit' | |
| else | |
| flash.now[:error] = "Something was wrong. Try again." | |
| haml :'screenshots/new' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Screenshot | |
| include DataMapper::Resource | |
| property :id, Serial | |
| has n, :interactions | |
| def generate_png | |
| snap = WebSnap::Snapper.new('http://google.com', :format => 'png') | |
| file = snap.to_file("app/assets/images/screenshots/#{self.id}.png") |