<%# 広告を一つ一つ表示 %>
- <% @ads.each do |ad| %>
-
- ad_id :<%= ad.id %>
-
-
- text :<%= ad.text %>
-
-
- price :<%= ad.price %>
-
-
- <%= image_tag ad.image.to_s %>
-
-
- <%= link_to("Edit", edit_ad_path(ad)) %>
-
-
- <%= link_to("Delete", ad_path(ad) ,method: :delete) %>
-
- <% end %>
-
- <%= link_to("New", new_ad_path) %>
-
+
+
+ <%= link_to("新規作成", new_ad_path) %>
+
+
+
+
+
+
+ 広告ID |
+ 広告主ID |
+ テキスト |
+ 単価 |
+ イメージ画像 |
+ 操作 |
+
+
+
+
+ <% @ads.each do |ad| %>
+ <%= ad.id %> |
+ <%= ad.advertiser_id %> |
+ <%= ad.text %> |
+ <%= ad.price %> |
+ <%= image_tag ad.image.to_s %> |
+
+ <%= link_to("変更", edit_ad_path(ad)) %>
+
+
+ <%= link_to("削除", ad_path(ad) ,method: :delete) %>
+
+ |
+
+ <% end %>
+
+
diff --git a/app/views/ad/new.html.erb b/app/views/ad/new.html.erb
index a841e3b..fd331f4 100644
--- a/app/views/ad/new.html.erb
+++ b/app/views/ad/new.html.erb
@@ -1,14 +1,14 @@
<%= render partial: "errorlog" %>
<%= form_for(@ad ,url: ad_index_path,html: {method: "post",class: "form-group"}) do |f| %> <%##入稿フォーム %>
-
-
text
+
<% end %>
diff --git a/db/migrate/20190604073026_add_report_column_to_ads.rb b/db/migrate/20190604073026_add_report_column_to_ads.rb
deleted file mode 100644
index bf8d75f..0000000
--- a/db/migrate/20190604073026_add_report_column_to_ads.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-class AddReportColumnToAds < ActiveRecord::Migration[5.2]
- def change
- add_column :ads, :click, :integer
- add_column :ads, :imp, :integer
- add_column :ads, :cv, :integer
- end
-end
diff --git a/db/schema.rb b/db/schema.rb
index d6923dc..f887c36 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_06_04_073026) do
+ActiveRecord::Schema.define(version: 2019_05_28_085221) do
create_table 'ads', force: :cascade do |t|
t.integer 'advertiser_id', default: 0, null: false
t.string 'image', default: '', null: false
@@ -19,8 +19,5 @@
t.string 'text', default: '', null: false
t.datetime 'created_at', null: false
t.datetime 'updated_at', null: false
- t.integer 'click'
- t.integer 'imp'
- t.integer 'cv'
end
end
diff --git a/spec/controllers/ad_controller_spec.rb b/spec/controllers/ad_controller_spec.rb
index f8471fd..4cc4a3d 100644
--- a/spec/controllers/ad_controller_spec.rb
+++ b/spec/controllers/ad_controller_spec.rb
@@ -58,8 +58,7 @@
'price' => nil,
'advertiser_id' => nil,
'image' => nil
- },
- id: @ad.id }
+ }, id: @ad.id }
expect(response).to render_template :edit
end
@@ -89,15 +88,14 @@
'price' => 1010101,
'advertiser_id' => 1010101,
'image' => Rack::Test::UploadedFile.new(File.join(Rails.root, 'spec/fixture/image.jpg'))
- },
- id: @ad.id }
+ }, id: @ad.id }
expect(response).to redirect_to(ad_index_path)
end
end
context 'when something empty' do
it 'without text should be rendered' do
- patch :update, params: { ad: { 'text' =>nil }, id: @ad.id }
+ patch :update, params: { ad: { 'text' => nil }, id: @ad.id }
expect(response).to render_template :edit
end
@@ -122,8 +120,7 @@
'price' => nil,
'advertiser_id' => nil,
'image' => nil
- },
- id: @ad.id }
+ }, id: @ad.id }
expect(response).to render_template :edit
end
end
diff --git a/spec/features/path_spec.rb b/spec/features/path_spec.rb
index aab875b..763b951 100644
--- a/spec/features/path_spec.rb
+++ b/spec/features/path_spec.rb
@@ -42,7 +42,7 @@
end
it 'new valid?' do
- click_link('New')
+ click_link('新規作成')
expect(current_path).to eq new_ad_path
end
end
@@ -50,7 +50,7 @@
describe 'Buttons' do
context 'after new ad created' do
before do
- visit 'ad/new'
+ visit new_ad_path
fill_in 'ad_text', with: 'TextForm'
fill_in 'ad_price', with: '1000'
fill_in 'ad_advertiser_id', with: '1'
@@ -64,11 +64,11 @@
context 'on Index Page' do
it 'edit clickable' do
- click_link('Edit')
+ click_link('変更')
end
it 'Delete clickable and its action workable' do
- expect { click_link 'Delete' }.to change { Ad.count }.by(-1)
+ expect { click_link '削除' }.to change { Ad.count }.by(-1)
end
end
end
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
deleted file mode 100644
index 7ff7b4d..0000000
--- a/test/application_system_test_case.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: true
-require 'test_helper'
-
-class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
- driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
-end
diff --git a/test/controllers/.keep b/test/controllers/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/controllers/ad_controller_test.rb b/test/controllers/ad_controller_test.rb
deleted file mode 100644
index 31b53d3..0000000
--- a/test/controllers/ad_controller_test.rb
+++ /dev/null
@@ -1,40 +0,0 @@
-# frozen_string_literal: true
-require 'test_helper'
-
-class AdControllerTest < ActionDispatch::IntegrationTest
- test 'should get index' do
- get ad_index_url
- assert_response :success
- end
-
- test 'should get show' do
- get ad_show_url
- assert_response :success
- end
-
- test 'should get edit' do
- get ad_edit_url
- assert_response :success
- end
-
- test 'should get new' do
- get ad_new_url
- assert_response :success
- end
-
- test 'should get create' do
- get ad_create_url
- assert_response :success
- end
-
- test 'should get edit' do
- get ad_edit_url
- assert_response :success
- end
-
- test 'should get destroy' do
- get ad_destroy_url
- assert_response :success
- end
-
-end
diff --git a/test/fixtures/.keep b/test/fixtures/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/fixtures/ads.yml b/test/fixtures/ads.yml
deleted file mode 100644
index 3d12954..0000000
--- a/test/fixtures/ads.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
-
-one:
- advertiser_id: 1
- image: MyString
- price: MyString
- text: MyString
-
-two:
- advertiser_id: 1
- image: MyString
- price: MyString
- text: MyString
diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/helpers/.keep b/test/helpers/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/integration/.keep b/test/integration/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/mailers/.keep b/test/mailers/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/models/.keep b/test/models/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/models/ad_test.rb b/test/models/ad_test.rb
deleted file mode 100644
index c4220fc..0000000
--- a/test/models/ad_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: true
-require 'test_helper'
-
-class AdTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
-end
diff --git a/test/system/.keep b/test/system/.keep
deleted file mode 100644
index e69de29..0000000
diff --git a/test/test_helper.rb b/test/test_helper.rb
deleted file mode 100644
index 58af444..0000000
--- a/test/test_helper.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-ENV['RAILS_ENV'] ||= 'test'
-require_relative '../config/environment'
-require 'rails/test_help'
-
-class ActiveSupport::TestCase
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
- fixtures :all
-
- # Add more helper methods to be used by all tests here...
-end