Sha256: 1f36ac4f706ac7e4b3d8d805a3436596930460d1f4e932c177551ddd71a280a5

Contents?: true

Size: 1.63 KB

Versions: 6

Compression:

Stored size: 1.63 KB

Contents

require "#{File.dirname(__FILE__)}/../test_helper"

RESULT_DIR = File.dirname(__FILE__) + "/../../test/result/"

class GeneralStoriesTest < ActionController::IntegrationTest
  fixtures :articles

  def assert_html(path)
    open(RESULT_DIR + path) {|io|
      data = io.read
      assert_equal data, @response.body
    }
  end
  def setup
    @first_id = articles(:first).id
  end

  def test_list
    get "/articles/list", nil, :accept_language => "ja"
    assert_html("ja/list.html")
    assert_response :success

    get "/articles/list", nil, :accept_language => "en"
    assert_html("en/list.html")
  end

  def test_show
    get "/articles/show/1", nil, :accept_language => "ja"
    assert_html("ja/show.html")
    assert_response :success
    assert_not_nil assigns(:article)
    assert assigns(:article).valid?

    get "/articles/show/1", nil, :accept_language => "en"
    assert_html("en/show.html")
  end

  def test_new
    get "/articles/new", nil, :accept_language => "ja"
    assert_html("ja/new.html")
    assert_response :success
    assert_not_nil assigns(:article)

    get "/articles/new", nil, :accept_language => "en"
    assert_html("en/new.html")
    assert_response :success
    assert_not_nil assigns(:article)
  end

  def test_create_error
    num_articles = Article.count
    post "/articles/create", {:article => {:title => "", :description => "", :lastupdate => Date.new(2007, 4, 1)}}, :accept_language => "ja"
    assert_html("ja/create_error.html")

    post "/articles/create", {:article => {:title => "", :description => "", :lastupdate => Date.new(2007, 4, 1)}}, :accept_language => "en"
    assert_html("en/create_error.html")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 test/rails/test/integration/general_stories_test.rb
gettext-1.10.0 test/rails/test/integration/general_stories_test.rb
gettext-1.90.0 test/rails/test/integration/general_stories_test.rb
gettext-1.91.0 test/rails/test/integration/general_stories_test.rb
gettext-1.92.0 test/rails/test/integration/general_stories_test.rb
gettext-1.93.0 test/rails/test/integration/general_stories_test.rb