From 545a2b66e6cbc3856326735eb07e095f0a5b46c5 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Sun, 25 Nov 2012 15:41:02 +0100 Subject: [PATCH] new stuff --- .rspec | 2 +- Gemfile.lock | 2 +- app/helpers/cmtool/application_helper.rb | 8 ++++---- lib/cmtool/menu.rb | 1 + spec/acceptance/acceptance_helper.rb | 4 ++++ spec/acceptance/support/helpers.rb | 6 ++++++ spec/acceptance/support/paths.rb | 9 +++++++++ 7 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 spec/acceptance/acceptance_helper.rb create mode 100644 spec/acceptance/support/helpers.rb create mode 100644 spec/acceptance/support/paths.rb diff --git a/.rspec b/.rspec index 53607ea..4e1e0d2 100644 --- a/.rspec +++ b/.rspec @@ -1 +1 @@ ---colour +--color diff --git a/Gemfile.lock b/Gemfile.lock index 55203c5..bf1dd32 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,7 +19,7 @@ GIT PATH remote: . specs: - cmtool (0.0.1) + cmtool (0.4.0) bourbon coffee-script devise diff --git a/app/helpers/cmtool/application_helper.rb b/app/helpers/cmtool/application_helper.rb index a0387a8..6e2bec5 100644 --- a/app/helpers/cmtool/application_helper.rb +++ b/app/helpers/cmtool/application_helper.rb @@ -80,11 +80,11 @@ module Cmtool t('cmtool.action.destroy.title', model: obj.class.model_name.human) end - def create_button_text(obj) - t('cmtool.action.create.label', model: obj.class.model_name.human) + def create_button_text(obj = nil) + t('cmtool.action.create.label', model: obj ? obj.class.model_name.human : '') end - def update_button_text(obj) - t('cmtool.action.update.label', model: obj.class.model_name.human) + def update_button_text(obj = nil) + t('cmtool.action.update.label', model: obj ? obj.class.model_name.human : '') end def link_separator ' | ' diff --git a/lib/cmtool/menu.rb b/lib/cmtool/menu.rb index 6cdbe90..226c9e6 100644 --- a/lib/cmtool/menu.rb +++ b/lib/cmtool/menu.rb @@ -103,6 +103,7 @@ module Cmtool end def engine + return @options[:engine] if @options[:engine].present? base = @options[:scope].presence base ||= @resource.name.split('::').first if @resource.name.index('::') return Rails.application unless base diff --git a/spec/acceptance/acceptance_helper.rb b/spec/acceptance/acceptance_helper.rb new file mode 100644 index 0000000..71946ad --- /dev/null +++ b/spec/acceptance/acceptance_helper.rb @@ -0,0 +1,4 @@ +require 'spec_helper' + +# Put your acceptance spec helpers inside spec/acceptance/support +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} \ No newline at end of file diff --git a/spec/acceptance/support/helpers.rb b/spec/acceptance/support/helpers.rb new file mode 100644 index 0000000..ed4c0e0 --- /dev/null +++ b/spec/acceptance/support/helpers.rb @@ -0,0 +1,6 @@ +module HelperMethods + # Put helper methods you need to be available in all acceptance specs here. + +end + +RSpec.configuration.include HelperMethods, :type => :acceptance \ No newline at end of file diff --git a/spec/acceptance/support/paths.rb b/spec/acceptance/support/paths.rb new file mode 100644 index 0000000..e3b8307 --- /dev/null +++ b/spec/acceptance/support/paths.rb @@ -0,0 +1,9 @@ +module NavigationHelpers + # Put helper methods related to the paths in your application here. + + def homepage + "/" + end +end + +RSpec.configuration.include NavigationHelpers, :type => :acceptance \ No newline at end of file