[PATCH conductor] Fix the Hardware Profile form
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
Update to Rails 3 and newer HAML made our code obsolete and at some points
even nonfunctional.
---
src/app/views/hardware_profiles/_form.haml | 16 +++++++---------
src/app/views/hardware_profiles/new.haml | 2 +-
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/app/views/hardware_profiles/_form.haml b/src/app/views/hardware_profiles/_form.haml
index 6ad9a6f..8326038 100644
--- a/src/app/views/hardware_profiles/_form.haml
+++ b/src/app/views/hardware_profiles/_form.haml
@@ -1,19 +1,17 @@
= error_messages_for @hardware_profile
-=hwp_form.label :name
-=hwp_form.text_field :name
+= hwp_form.label :name
+= hwp_form.text_field :name
%table
= sortable_table_header @header
- [:memory, :cpu, :storage, :architecture].each do |type|
- - hwp_form.fields_for type do |hwpp_form|
+ = hwp_form.fields_for type do |hwpp_form|
%tr
- %td
- =hwpp_form.text_field(:name, :readonly => "readonly")
- %td
- =hwpp_form.text_field(:unit, :size => 5, :readonly => "readonly")
+ %td= hwpp_form.text_field(:name, :readonly => "readonly")
+ %td= hwpp_form.text_field(:unit, :size => 5, :readonly => "readonly")
%td
-if type == :architecture
- =hwpp_form.select("value", ["i386", "x86_64"], {})
+ = hwpp_form.select("value", ["i386", "x86_64"], {})
-else
- =hwpp_form.text_field(:value)
+ = hwpp_form.text_field(:value)
= hwp_form.submit 'Check Matches', :class => "submit button", :id => 'check_matches'
= hwp_form.submit 'Save', :class => 'submit button', :id => 'save_button'
diff --git a/src/app/views/hardware_profiles/new.haml b/src/app/views/hardware_profiles/new.haml
index fc08757..16ec045 100644
--- a/src/app/views/hardware_profiles/new.haml
+++ b/src/app/views/hardware_profiles/new.haml
@@ -6,7 +6,7 @@
%h2 New Hardware Profile
.content
- -form_for @hardware_profile, :url => hardware_profiles_path, :html => { :multipart => true } do |hwp_form|
+ = form_for @hardware_profile, :url => hardware_profiles_path, :html => { :multipart => true } do |hwp_form|
= render :partial => "form", :locals => { :hwp_form => hwp_form }
= render :partial => 'matching_provider_hardware_profiles' if params[:commit] == 'Check Matches'
--
1.7.6
12 years, 9 months
[PATCH conductor] Fix a couple view issues with hardware profiles
by Matt Wagner
The sortable_table_header method isn't calling .html_safe on collected tags,
causing escaped HTML tags to be strewn about the page.
I have also removed what seems to be a typo/syntax error from the
_matching_provider_hardware_profiles.haml partial that caused it to fail.
-- Matt
12 years, 9 months
re: Gemfile and dev/test dependencies
by Simon Harris
Are we agreed that we'll add a step to the RPM build process to add a .bundle directory with the appropriate files to prevent dev and test dependencies being loaded in production?
If so, can I commit a Gemfile with those dependencies uncommented?
12 years, 9 months
[PATCH 1/5] Fix deprecation warning: RAILS_ROOT is deprecated
by Simon Harris
From: Simon Harris <sharris(a)redhat.com>
---
src/spec/spec_helper.rb | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/spec/spec_helper.rb b/src/spec/spec_helper.rb
index 46bfa72..716acc7 100644
--- a/src/spec/spec_helper.rb
+++ b/src/spec/spec_helper.rb
@@ -15,7 +15,8 @@ RSpec.configure do |config|
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
- config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
+ config.fixture_path = Rails.root.join("spec/fixtures")
+
#
# == Mock Framework
#
--
1.7.4.4
12 years, 9 months
[PATCH] At least while were undecided, stop git complaining
by Simon Harris
From: Simon Harris <sharris(a)redhat.com>
---
.gitignore | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 827f787..feeab43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,6 @@ src/public/stylesheets/compiled
development.sqlite3
production.sqlite3
test.sqlite3
+
+Gemfile.lock
+
--
1.7.4.4
12 years, 9 months
[PATCH conductor] #2018 - Cucumber test fixes
by Matt Wagner
Hi all,
This series of patches fixes some of the currently-failing Cucumber tests. Note that there are still a *lot* that need fixing. I'll send an email shortly outlining some of them. This patch series also contains a couple of things that weren't broken tests per se, but were either spewing voluminous deprecation warnings (overwriting .validate), or that impeded debugging (handle_error not printing backtraces) and should be fixed anyway.
On the note of the .validate deprecation warnings, some external dependency of ours seems to be doing it. I've fixed all occurences in our app (AFAICT) and it's still printed in some spots. This is just a deprecation warning, not a fatal error, so it's not a top priority just yet anyway.
-- Matt
12 years, 9 months
Remaining conductor spec failures
by Simon Harris
I'm now down to following 6 failures. Are any of them pending, or perhaps the expectations need to be altered to respect the desired behaviour?
1) ProvidersController should provide ui to view hardware profiles
Failure/Error: response.should render_template("providers/_hw_profiles")
expecting <"providers/_hw_profiles"> but rendering with <"providers/show, layouts/application">
# ./spec/controllers/provider_controller_spec.rb:20
2) ProvidersController should provide ui to view realms
Failure/Error: response.should render_template("providers/_realms")
expecting <"providers/_realms"> but rendering with <"providers/show, layouts/application">
# ./spec/controllers/provider_controller_spec.rb:30
3) UsersController#create user enters valid input fails to create pool
Failure/Error: returned_user.should have(2).errors_on(:email)
expected 2 errors on :email, got 1
# ./spec/controllers/users_controller_spec.rb:39
4) Provider (using stubbed out connect method) should be able to connect to the specified framework
Failure/Error: @provider.should have(1).error_on(:url)
expected 1 error on :url, got 0
# ./spec/models/provider_spec.rb:49
5) Provider (using stubbed out connect method) should not destroy provider if deletion of associated cloud account fails
Failure/Error: provider.destroyed?.should be_false
expected true to be false
# ./spec/models/provider_spec.rb:83
6) RegistrationService with quota passed via nested attributes to user model
Failure/Error: registration_process.save.should be_true
expected false to be true
# ./spec/services/registration_service_spec.rb:55
12 years, 9 months
[PATCH] Fixed broken tests: AR::Base#errors always returns an array of strings
by Simon Harris
From: Simon Harris <sharris(a)redhat.com>
---
src/spec/models/pool_family_spec.rb | 8 ++++----
src/spec/models/pool_spec.rb | 4 ++--
src/spec/models/role_spec.rb | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/spec/models/pool_family_spec.rb b/src/spec/models/pool_family_spec.rb
index c298668..589b2e9 100644
--- a/src/spec/models/pool_family_spec.rb
+++ b/src/spec/models/pool_family_spec.rb
@@ -33,16 +33,16 @@ describe PoolFamily do
it "should not be valid if name is too long" do
@pool_family.name = ('a' * 256)
- @pool_family.valid?.should be_false
+ @pool_family.should_not be_valid
@pool_family.errors[:name].should_not be_nil
- @pool_family.errors[:name].should =~ /^is too long.*/
+ @pool_family.errors[:name].grep(/^is too long.*/).should_not be_empty
end
it "should not be valid if name contains special characters" do
@pool_family.name = '.'
- @pool_family.valid?.should be_false
+ @pool_family.should_not be_valid
@pool_family.errors[:name].should_not be_nil
- @pool_family.errors[:name].should =~ /^must only contain.*/
+ @pool_family.errors[:name].grep(/^must only contain.*/).should_not be_empty
end
it "should require quota to be set" do
diff --git a/src/spec/models/pool_spec.rb b/src/spec/models/pool_spec.rb
index adedc16..a9df7ef 100644
--- a/src/spec/models/pool_spec.rb
+++ b/src/spec/models/pool_spec.rb
@@ -17,9 +17,9 @@ describe Pool do
it "should not be valid if name is too long" do
u = FactoryGirl.create(:pool)
u.name = ('a' * 256)
- u.valid?.should be_false
+ u.should_not be_valid
u.errors[:name].should_not be_nil
- u.errors[:name].should =~ /^is too long.*/
+ u.errors[:name].grep(/^is too long.*/).should_not be_empty
end
it "should not be destroyable when it has running instances" do
diff --git a/src/spec/models/role_spec.rb b/src/spec/models/role_spec.rb
index 8adc580..956fbda 100644
--- a/src/spec/models/role_spec.rb
+++ b/src/spec/models/role_spec.rb
@@ -5,8 +5,8 @@ describe Role do
it "should not be valid if name is too long" do
u = FactoryGirl.create(:role)
u.name = ('a' * 256)
- u.valid?.should be_false
+ u.should_not be_valid
u.errors[:name].should_not be_nil
- u.errors[:name].should =~ /^is too long.*/
+ u.errors[:name].grep(/^is too long.*/).should_not be_empty
end
end
--
1.7.4.4
12 years, 9 months