Sha256: a6afde86b386094d79771639afed92680f7045507f04cf3f0405ada75503ddbd

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

# encoding: utf-8

Given /^an ActiveRecord 'User' model with an 'enabled' boolean field and a 'username' field$/ do
  # Done: see the dummy rails app
end

When /^I create a user named '([^']+)' with '([^']+)' set to true$/ do |username, column|
  User.create :username => username, column.intern => true
end

Then /^the '([^']+)' column for '([^']+)' should be '(-?\d+)'$/ do |column, username, value|
  user = User.find_by_username(username)
  user.send("#{column}_before_type_cast").should == value.to_i
end

When /^I load a user named '([^']+)' who's '([^']+)' column is '(-?\d+)'$/ do |username, column, value|
  @user = User.send("find_by_username_and_#{column}", username, value.to_i)
  @user || raise("Unable to find user '#{username}' (who's '#{column}' column is '#{value}')")
end

Then /^the user model's '([^']+)' field for '([^']+)' should be true$/ do |column, username|
  @user.username.should == username
  @user.send("#{column}?").should be_true
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
army-negative-3.1.0 features/support/step_definitions.rb
army-negative-3.0.0 features/support/step_definitions.rb