Skip to content

Commit

Permalink
Test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Apr 12, 2010
1 parent 0124bc1 commit 4d13b7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
7 changes: 3 additions & 4 deletions app/controllers/editor/auth_renderer.rb
Expand Up @@ -240,7 +240,6 @@ def user_edit_account

# if there are no errors on anything
# save the user,

@failed = true unless all_valid

if all_valid
Expand Down Expand Up @@ -765,9 +764,9 @@ def assign_entry(model, data, available_fields, required_fields)
model.valid?

required_fields.each do |fld|
if model.send(fld.to_sym).blank?
model.errors.add(fld.to_sym, 'is missing')
end
if model.send(fld.to_sym).blank?
model.errors.add(fld.to_sym, 'is missing')
end
end

model.errors.length == 0
Expand Down
5 changes: 3 additions & 2 deletions spec/controllers/editor/auth_renderer_spec.rb
Expand Up @@ -74,10 +74,11 @@ def generate_renderer(data = {})
end

it "shouldn't save if required address fields aren't there" do
assert_difference "EndUserAddress.count", 0 do
@rnd = generate_renderer(:address_required_fields => ['state'])
renderer_post @rnd, :user => { :email => "test@webiva.com", :password => "test", :password_confirmation => "test" }, :address => { :address => '123 Elm St',:city => 'Boston' }
renderer_post @rnd, :user => { :email => "test@webiva.com", :password => "test", :password_confirmation => "test" }, :address => { :address => '123 Elm St',:city => 'Boston' }
end

EndUser.count.should == 0
end

it "should save if all required address fields are there" do
Expand Down
9 changes: 4 additions & 5 deletions spec/spec_helper.rb
Expand Up @@ -90,18 +90,17 @@ def reset_domain_tables(*tables)
DomainModel.connection.execute("TRUNCATE #{table.is_a?(Symbol) ? table.to_s.tableize : table}") unless %w(component_schemas).include?(table)
end
end
before_each_parts << callback
before(:each,&callback)
after(:each,&callback)
end

def transaction_reset
before(:all) {
before(:each) {
DomainFile.root_folder
UserClass.create_built_in_classes
SiteVersion.default
}
prepend_before(:each) {
WebivaCleaner.cleaner.start }
append_after(:each) { WebivaCleaner.cleaner.clean }
after(:each) { WebivaCleaner.cleaner.clean }
end

# Activate a module in a test (force the activation) so you can use handlers etc.
Expand Down

0 comments on commit 4d13b7f

Please sign in to comment.