Sha256: c15d2a7e054e2ea082ece9701b357e4679eed036173bc2f06326af7471964741

Contents?: true

Size: 1.9 KB

Versions: 8

Compression:

Stored size: 1.9 KB

Contents

require 'rails_helper'
RSpec.feature 'Messages' do
  include_context 'loaded site'

  before do
    login_as first_user
  end
  describe 'Drafting', js: true do
    describe 'at /box/in/messages' do
      before do
        visit '/box/in/messages/new/'
        recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
        recipient_input.set("")
        fill_in 'Subject', with: 'This is a draft.'
        fill_in 'Body', with: 'This is the body.'
        click_button 'Send'
      end
      it_behaves_like 'a bootstrap page with an alert', 'warning', 'Message saved as draft.'
    end
  end
  describe 'Composing', js: true do
    describe 'at /box/in/messages' do
      before do
        visit '/box/in/messages/new/'
        recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
        recipient_input.set("sec")
        recipient_input.native.send_keys :arrow_down
        recipient_input.native.send_keys :return
        fill_in 'Subject', with: 'This is the subject.'
        fill_in 'Body', with: 'This is the body.'
        click_button 'Send'
      end
      it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
    end
  end
  describe 'Editing a Draft', js: true do
    describe 'at /box/in/messages' do
      before do
        visit "/box/in/conversations/#{draft_conversation.id}"
        recipient_input = find(:css, "#message_recipients_to_save_users .tags-input")
        recipient_input.set("sec")
        recipient_input.native.send_keys :arrow_down
        recipient_input.native.send_keys :return
        fill_in 'Subject', with: 'This is the subject.'
        fill_in 'Body', with: 'This is the body.'
        find(:css, "#message_draft").set(false)
        click_button 'Send'
      end
      it_behaves_like 'a bootstrap page with an alert', 'info', 'Message sent.'
      it_behaves_like 'a bootstrap page without an alert', 'warning'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
message_train-0.1.7 spec/features/messages_spec.rb
message_train-0.1.6 spec/features/messages_spec.rb
message_train-0.1.5 spec/features/messages_spec.rb
message_train-0.1.4 spec/features/messages_spec.rb
message_train-0.1.3 spec/features/messages_spec.rb
message_train-0.1.2 spec/features/messages_spec.rb
message_train-0.1.1 spec/features/messages_spec.rb
message_train-0.1.0 spec/features/messages_spec.rb