Skip to content

Commit

Permalink
Merge 0915a3c into 1514ab4
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaochaocha3 committed Apr 8, 2017
2 parents 1514ab4 + 0915a3c commit 3b0ee2a
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 41 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ rvm:
services:
- mysql
sudo: required
env:
- COVERALLS_PARALLEL=true
before_install:
- curl --silent --location https://github.com/groonga/groonga/raw/master/data/travis/setup.sh | sh
- sudo apt-get install -y -V mysql-server-mroonga
Expand Down
10 changes: 0 additions & 10 deletions db/migrate/20161128185000_add_indices_to_covnersation_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,5 @@ def change
add_index :conversation_messages, [:id, :timestamp]

add_index :conversation_messages, :message, type: :fulltext

reversible do |dir|
dir.up do
execute('ALTER TABLE conversation_messages DISABLE KEYS')
execute('ALTER TABLE conversation_messages ENABLE KEYS')
end

dir.down do
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
class AddIndexForTypeToConversationMessages < ActiveRecord::Migration
def change
add_index :conversation_messages, :type

reversible do |dir|
dir.up do
execute('ALTER TABLE conversation_messages DISABLE KEYS')
execute('ALTER TABLE conversation_messages ENABLE KEYS')
end

dir.down do
end
end
end
end
26 changes: 5 additions & 21 deletions db/migrate/20170403224903_add_indices_to_conversation_messages.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
class AddIndicesToConversationMessages < ActiveRecord::Migration
reversible do |dir|
dir.up do
remove_index :conversation_messages, column: :nick
def change
remove_index :conversation_messages, column: :nick

add_index :conversation_messages, :nick, type: :fulltext
add_index :conversation_messages, [:nick, :message], type: :fulltext
add_index :conversation_messages, [:channel_id, :timestamp]

execute('ALTER TABLE conversation_messages DISABLE KEYS')
execute('ALTER TABLE conversation_messages ENABLE KEYS')
end

dir.down do
add_index :conversation_messages, :nick

remove_index :conversation_messages, column: :nick
remove_index :conversation_messages, column: [:nick, :message]
remove_index :conversation_messages, column: [:channel_id, :timestamp]

execute('ALTER TABLE conversation_messages DISABLE KEYS')
execute('ALTER TABLE conversation_messages ENABLE KEYS')
end
add_index :conversation_messages, :nick, type: :fulltext
add_index :conversation_messages, [:nick, :message], type: :fulltext
add_index :conversation_messages, [:channel_id, :timestamp]
end
end
6 changes: 6 additions & 0 deletions test/integration/channels_edit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ class ChannelsEditTest < ActionDispatch::IntegrationTest
setup do
@setting = create(:setting)
@user = create(:user)

Channel.delete_all
@channel = create(:channel)
end

teardown do
Channel.delete_all
end

test 'ログインしている場合、表示される' do
login_user(@user)

Expand Down
6 changes: 6 additions & 0 deletions test/integration/channels_index_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ class ChannelsIndexTest < ActionDispatch::IntegrationTest
setup do
@setting = create(:setting)
@user = create(:user)

Channel.delete_all
@channel = create(:channel)
end

teardown do
Channel.delete_all
end

test '表示される' do
get(channels_path)
assert_response(:success)
Expand Down
6 changes: 6 additions & 0 deletions test/integration/channels_show_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ class ChannelsShowTest < ActionDispatch::IntegrationTest
setup do
@setting = create(:setting)
@user = create(:user)

Channel.delete_all
@channel = create(:channel)
end

teardown do
Channel.delete_all
end

test '表示される' do
get(channel_path(@channel))
assert_response(:success)
Expand Down
4 changes: 4 additions & 0 deletions test/integration/channels_update_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class ChannelsUpdateTest < ActionDispatch::IntegrationTest
@channel = create(:channel)
end

teardown do
Channel.delete_all
end

test 'ログインしていない場合、ログインページにリダイレクトされる' do
logout_user

Expand Down

0 comments on commit 3b0ee2a

Please sign in to comment.