fixing saves

This commit is contained in:
Torsten 2022-12-22 21:28:00 +02:00
parent 168320d6ee
commit 5c4123c012
9 changed files with 49 additions and 6 deletions

View File

@ -5,11 +5,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec
gem 'sprockets-rails', require: 'sprockets/railtie'
gem 'rspec-rails' , require: "rspec-rails"
gem 'haml-rails' , require: "haml-rails"
gem "tailwindcss-rails"
gem "importmap-rails"
gem "sprockets-rails"
gem "devise"
gem "ruby2js" , path: "../ruby2js"
@ -19,6 +19,8 @@ group :development, :test do
gem "selenium-webdriver"
gem "webdrivers"
gem "puma"
gem 'rspec-rails' , require: "rspec-rails"
gem 'guard-minitest'
end
# Start debugger with binding.b [https://github.com/ruby/debug]

View File

@ -90,6 +90,7 @@ GEM
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bcrypt (3.1.18)
builder (3.2.4)
capybara (3.38.0)
addressable
@ -103,6 +104,12 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.1.10)
crass (1.0.6)
devise (4.8.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
diff-lcs (1.5.0)
erubi (1.11.0)
ffi (1.15.5)
@ -122,6 +129,9 @@ GEM
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-minitest (2.4.6)
guard-compat (~> 1.2)
minitest (>= 3.0)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
@ -170,6 +180,7 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
parser (3.1.3.0)
ast (~> 2.4.1)
pry (0.14.1)
@ -215,6 +226,9 @@ GEM
rchardet (1.8.0)
redcarpet (3.5.1)
regexp_parser (2.1.1)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
@ -258,6 +272,8 @@ GEM
timeout (0.3.0)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
warden (1.2.9)
rack (>= 2.0.9)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
@ -275,6 +291,8 @@ PLATFORMS
DEPENDENCIES
capybara
devise
guard-minitest
guard-rspec
haml-rails
importmap-rails

View File

@ -24,6 +24,14 @@
# * zeus: 'zeus rspec' (requires the server to be started separately)
# * 'just' rspec: 'rspec'
guard :minitest do
# with Minitest::Unit
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" }
watch(%r{^test/test_helper\.rb$}) { 'test' }
end
guard :rspec, cmd: "bundle exec rspec" do
require "guard/rspec/dsl"
dsl = Guard::RSpec::Dsl.new(self)

View File

@ -45,7 +45,7 @@ module Merged
@card.option_definitions.each do |option|
@card.set_option(option.name, options[option.name])
end if options
@card.save
@card.save(current_member)
redirect_to section_cards_url(@card.section.id) , notice: "Updated #{@card.header}"
end

View File

@ -75,7 +75,7 @@ module Merged
@section.option_definitions.each do |option|
@section.set_option(option.name, options[option.name])
end if options
@section.save
@section.save(current_member.email)
redirect_to :section , notice: "Update ok"
end

View File

@ -60,11 +60,10 @@ module Merged
[has_sections , has_cards]
end
def save
def save(editor)
olds = self.redirects.to_s.split(" ")
olds.delete( self.name.to_s )
self.redirects = olds.join(" ")
updated_at = Time.now
super
end

View File

@ -12,6 +12,12 @@ module Merged
fields :options , :updated_at , :updated_by
def save( editor )
self.updated_at = Time.now
self.updated_by = editor
super()
end
def has_option?(option)
options.has_key?(option) and !options[option].blank?
end

View File

@ -22,7 +22,7 @@
= yellow_button("Change Image", merged.images_path(section_id: @section.id))
= red_button( "Remove image", merged.section_set_image_path( @section.id , image: ""))
.basis-80.grow
.basis-80.grow.content_update
= section_form( class: "mx-auto mt-8 mb-0 max-w space-y-4") do
%label.block
%h4.text-lg.font-bold Header

View File

@ -17,5 +17,15 @@ RSpec.feature "Sections", type: :feature do
find_link("Edit").click
end
end
describe "show page" do
it "returns http success" do
visit "/merged/pages"
click_on ("index")
within("#section_31") do
find_link("Edit").click
end
end
end
end
end