Sha256: 813e21839e84232222202c96db6e6c0a83a7d88d76683f52b1c4bbe26dbabf7d

Contents?: true

Size: 1.39 KB

Versions: 7

Compression:

Stored size: 1.39 KB

Contents

require 'wagn/spec_helper'

describe CardController, "location test from old integration" do

  include Wagn::Location

  before do
    login_as 'joe_user'
  end

  it "should test_previous_location_should_be_assigned_after_viewing" do
    get :read, :id=>"Joe_User"
    assert_equal "/Joe_User", assigns['previous_location']
  end

  it "should test_previous_location_should_not_be_updated_by_nonexistent_card" do
    get :read, :id=>"Joe_User"
    get :read, :id=>"Not_Me"
    get :read, :id=>'*previous'
    assert_redirected_to '/Joe_User'
  end

  it "should test_return_to_special_url_when_logging_in_after_visit" do
    # not sure this still tests the case, controller tests do not test routes
    get :read, :id=>'*recent'
    assert_equal "/*recent",  assigns['previous_location']
  end

  # FIXME: this should probably be files in the spot for a delete test
  it "should test_removal_and_return_to_previous_undeleted_card_after_deletion" do
    t1 = t2 = nil
    Account.as_bot do
      t1 = Card.create! :name => "Testable1", :content => "hello"
      t2 = Card.create! :name => "Testable1+bandana", :content => "world"
    end

    get :read, :id => t1.key
    get :read, :id => t2.key

    post :delete, :id=> '~'+t2.id.to_s
    assert_nil Card[ t2.name ]
    assert_redirected_to "/#{t1.name}"

    post :delete, :id => '~'+t1.id.to_s
    assert_redirected_to '/'
    assert_nil Card[ t1.name ]
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wagn-1.12.13 spec/controllers/location_spec.rb
wagn-1.12.12 spec/controllers/location_spec.rb
wagn-1.12.11 spec/controllers/location_spec.rb
wagn-1.12.10 spec/controllers/location_spec.rb
wagn-1.12.9 spec/controllers/location_spec.rb
wagn-1.12.8 spec/controllers/location_spec.rb
wagn-1.12.7 spec/controllers/location_spec.rb