Sha256: f4d7380e07b95f8ecf69b9499fcdb0f24d3a44efb5f933140ff74c62111a3334

Contents?: true

Size: 1.04 KB

Versions: 227

Compression:

Stored size: 1.04 KB

Contents

Then /^I should find the following for the last (.*):$/ do |model, table|
  model_class = model.camelize.constantize
  last_instance = model_class.last or raise "No #{model.pluralize} exist"
  table.hashes.first.each do |key, value|
    last_instance.attributes[key].to_s.should == value
  end
end

Then /^there should be (\d+) (.*)$/ do |count, model|
  model_class = model.singularize.camelize.constantize
  model_class.count.should == count.to_i
end

Then /^the post "([^"]*)" should (not )?have the following tags?:$/ do |post_title, negate, table|
  post = Post.find_by_title!(post_title)

  table.hashes.each do |row|
    tag = Tag.find_by_name(row[:name])

    if negate
      post.tags.should_not include(tag)
    else
      post.tags.should include(tag)
    end
  end
end

Transform /^table:(?:.*,)?tags(?:,.*)?$/ do |table|
  table.map_column!("tags") do |tags|
    tags.split(',').map {|tag| Tag.find_by_name! tag.strip }
  end
  table
end

Before do
  Post.delete_all
  Tag.delete_all
  User.delete_all
  Category.delete_all
  CategoryGroup.delete_all
end

Version data entries

227 entries across 115 versions & 8 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/factory_girl-2.6.4/features/step_definitions/database_steps.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/database_steps.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/database_steps.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.0.0/features/step_definitions/database_steps.rb