|
| 1 | +require_relative "./spec_helper" |
| 2 | + |
| 3 | +describe "http://rubykaigi.org" do |
| 4 | + describe "/" do |
| 5 | + let(:res) { connection.get("http://rubykaigi.org/") } |
| 6 | + it "redirects to /?locale=en" do |
| 7 | + expect(res.status).to eq(302) |
| 8 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/?locale=en") |
| 9 | + end |
| 10 | + end |
| 11 | + |
| 12 | + describe "/?locale=en" do |
| 13 | + let(:res) { connection.get("http://rubykaigi.org/?locale=en") } |
| 14 | + it "redirects to /2013" do |
| 15 | + expect(res.status).to eq(302) |
| 16 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2013") |
| 17 | + end |
| 18 | + end |
| 19 | + |
| 20 | + describe "/?locale=ja" do |
| 21 | + let(:res) { connection.get("http://rubykaigi.org/?locale=ja") } |
| 22 | + it "redirects to /2013" do |
| 23 | + expect(res.status).to eq(302) |
| 24 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2013") |
| 25 | + end |
| 26 | + end |
| 27 | + |
| 28 | + describe "/2013" do |
| 29 | + let(:res) { connection.get("http://rubykaigi.org/2013") } |
| 30 | + it "should render the top page" do |
| 31 | + expect(res.status).to eq(200) |
| 32 | + expect(res.body).to include("<title>RubyKaigi 2013, May 30 - Jun 1</title>") |
| 33 | + end |
| 34 | + end |
| 35 | + |
| 36 | + describe "/2012" do |
| 37 | + let(:res) { connection.get("http://rubykaigi.org/2012") } |
| 38 | + it "should render the special 404 page" do |
| 39 | + expect(res.status).to eq(404) |
| 40 | + expect(res.body).to include("<title>RubyKaigi 2012: 404 Kaigi Not Found</title>") |
| 41 | + end |
| 42 | + end |
| 43 | + |
| 44 | + describe "/2011" do |
| 45 | + let(:res) { connection.get("http://rubykaigi.org/2011") } |
| 46 | + it "redirects to /2011/en" do |
| 47 | + expect(res.status).to eq(302) |
| 48 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2011/en") |
| 49 | + end |
| 50 | + end |
| 51 | + |
| 52 | + describe "/2011/en" do |
| 53 | + let(:res) { connection.get("http://rubykaigi.org/2011/en") } |
| 54 | + it "should render the top page" do |
| 55 | + expect(res.status).to eq(200) |
| 56 | + expect(res.body).to include("<title>RubyKaigi 2011(July 16 - 18)</title>") |
| 57 | + end |
| 58 | + end |
| 59 | + |
| 60 | + describe "/2010" do |
| 61 | + let(:res) { connection.get("http://rubykaigi.org/2010") } |
| 62 | + it "redirects to /2010" do |
| 63 | + expect(res.status).to eq(302) |
| 64 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2010/en") |
| 65 | + end |
| 66 | + end |
| 67 | + |
| 68 | + describe "/2010/en" do |
| 69 | + let(:res) { connection.get("http://rubykaigi.org/2010/en") } |
| 70 | + it "should render the top page" do |
| 71 | + expect(res.status).to eq(200) |
| 72 | + expect(res.body).to include("<title>RubyKaigi 2010, August 27-29</title>") |
| 73 | + end |
| 74 | + end |
| 75 | + |
| 76 | + describe "/2009" do |
| 77 | + let(:res) { connection.get("http://rubykaigi.org/2009") } |
| 78 | + it "redirects to /2009" do |
| 79 | + expect(res.status).to eq(302) |
| 80 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2009/en") |
| 81 | + end |
| 82 | + end |
| 83 | + |
| 84 | + describe "/2009/en" do |
| 85 | + let(:res) { connection.get("http://rubykaigi.org/2009/en") } |
| 86 | + it "should render the top page" do |
| 87 | + expect(res.status).to eq(200) |
| 88 | + expect(res.body).to include("<title>RubyKaigi2009</title>") |
| 89 | + end |
| 90 | + end |
| 91 | + |
| 92 | + describe "/2008" do |
| 93 | + let(:res) { connection.get("http://rubykaigi.org/2008") } |
| 94 | + it "redirects to /2008" do |
| 95 | + expect(res.status).to eq(302) |
| 96 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2008/en") |
| 97 | + end |
| 98 | + end |
| 99 | + |
| 100 | + describe "/2008/en" do |
| 101 | + let(:res) { connection.get("http://rubykaigi.org/2008/en") } |
| 102 | + it "should redirect to http://jp.rubyist.net/RubyKaigi2008" do |
| 103 | + expect(res.status).to eq(302) |
| 104 | + expect(res.headers["location"]).to eq("http://jp.rubyist.net/RubyKaigi2008") |
| 105 | + end |
| 106 | + end |
| 107 | + |
| 108 | + describe "/2007" do |
| 109 | + let(:res) { connection.get("http://rubykaigi.org/2007") } |
| 110 | + it "redirects to /2007" do |
| 111 | + expect(res.status).to eq(302) |
| 112 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2007/en") |
| 113 | + end |
| 114 | + end |
| 115 | + |
| 116 | + describe "/2007/en" do |
| 117 | + let(:res) { connection.get("http://rubykaigi.org/2007/en") } |
| 118 | + it "should redirect to http://jp.rubyist.net/RubyKaigi2007" do |
| 119 | + expect(res.status).to eq(302) |
| 120 | + expect(res.headers["location"]).to eq("http://jp.rubyist.net/RubyKaigi2007") |
| 121 | + end |
| 122 | + end |
| 123 | + |
| 124 | + describe "/2006" do |
| 125 | + let(:res) { connection.get("http://rubykaigi.org/2006") } |
| 126 | + it "redirects to /2006" do |
| 127 | + expect(res.status).to eq(302) |
| 128 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2006/en") |
| 129 | + end |
| 130 | + end |
| 131 | + |
| 132 | + describe "/2006/en" do |
| 133 | + let(:res) { connection.get("http://rubykaigi.org/2006/en") } |
| 134 | + it "should redirect to http://jp.rubyist.net/RubyKaigi2006" do |
| 135 | + expect(res.status).to eq(302) |
| 136 | + expect(res.headers["location"]).to eq("http://jp.rubyist.net/RubyKaigi2006") |
| 137 | + end |
| 138 | + end |
| 139 | + |
| 140 | + describe "/2005" do |
| 141 | + let(:res) { connection.get("http://rubykaigi.org/2005") } |
| 142 | + it "redirects to /2005" do |
| 143 | + expect(res.status).to eq(302) # NOTE 404 may be better |
| 144 | + expect(res.headers["location"]).to eq("http://rubykaigi.org/2005/en") |
| 145 | + end |
| 146 | + end |
| 147 | + |
| 148 | + describe "/2005/en" do |
| 149 | + let(:res) { connection.get("http://rubykaigi.org/2005/en") } |
| 150 | + it "should redirect to http://jp.rubyist.net/RubyKaigi2005" do |
| 151 | + expect(res.status).to eq(302) # NOTE 404 may be better |
| 152 | + expect(res.headers["location"]).to eq("http://jp.rubyist.net/RubyKaigi2005") |
| 153 | + end |
| 154 | + end |
| 155 | + |
| 156 | + # TODO consider ja locale case |
| 157 | +end |
0 commit comments