Sha256: 7f383a82cf275a6256967ba053a4efe6362f5dd2f63579c9684089a457bbc164

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

feature "Message", %q{} do

  background do
    @sender = FactoryGirl.create(:user)
    @recipient = FactoryGirl.create(:user)
    @user_conversation = FactoryGirl.create(:user_conversation, :user => @recipient)
    @user_conversation.conversation.users << @recipient
    @user_conversation.conversation.users << @sender
    @user_conversation.conversation.save!
  end

  scenario "create a new conversation" do
    visit user_path @sender
    click_link 'Sign In as This User'
    
    params = {"conversations_message"=>{"body"=>"Test"},
     "commit"=>"Create Message",
     "user_id"=>@sender.id,
     "conversation_id"=>@user_conversation.conversation.id}
    
    post user_conversation_messages_path params
    response.should redirect_to user_conversation_path(@sender, @user_conversation.conversation)
  end
  
  scenario "return to from committing a invalid conversation" do
    visit user_path @sender
    click_link 'Sign In as This User'
    
    params = {"commit"=>"Create Message",
     "user_id"=>@sender.id,
     "conversation_id"=>@user_conversation.conversation.id}
    
    post user_conversation_messages_path params
    response.should render_template("show")
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
conversations-0.0.2.2 spec/integration/messages_controller_spec.rb
conversations-0.0.2.1 spec/integration/messages_controller_spec.rb
conversations-0.0.2 spec/integration/messages_controller_spec.rb
conversations-0.0.1 spec/integration/messages_controller_spec.rb