Sha256: abb1469ec151bf3463ca097abf8a4e4ee17378f8b5a4b1542b84e95780cf3672

Contents?: true

Size: 1.24 KB

Versions: 10

Compression:

Stored size: 1.24 KB

Contents

# encoding: UTF-8
require File.expand_path(File.dirname(__FILE__) + '/acceptance_helper')

class RecodeController < ApplicationController
  class << self
    attr_accessor :string
  end

  def index
    render :layout => true, :inline => "Test"
  end

  def new
    render :layout => true, :inline => <<-EOD
    <form action="/recode/create" method="post">
    <input id="string" name="string" type="text">
    <input name="commit" type="submit" value="Submit">
    </form>
    EOD
  end

  def create
    self.class.string = params[:string]
  end
end

feature 'recode' do
  scenario 'au SSL', :driver => :au do
    visit 'https://www.example.com/recode/index'
    page.find(:xpath, '//head/meta')['content'].should == "text/html; charset=Shift_JIS"
  end

  scenario 'post request with Shift JIS data on au SSL', :driver => :au do
    visit 'https://www.example.com/recode/new'
    fill_in 'string', :with => "\x82\xA0".force_encoding("Shift_JIS")
    click_button "Submit"
    RecodeController.string.should == "あ"
  end

  scenario 'post request with UTF-8 data on au SSL', :driver => :au do
    visit 'https://www.example.com/recode/new'
    fill_in 'string', :with => "あ"
    click_button "Submit"
    RecodeController.string.should_not == "あ"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
galakei-0.13.7 spec/acceptance/recode_spec.rb
galakei-0.13.6 spec/acceptance/recode_spec.rb
galakei-0.13.5 spec/acceptance/recode_spec.rb
galakei-0.13.4 spec/acceptance/recode_spec.rb
galakei-0.13.3 spec/acceptance/recode_spec.rb
galakei-0.13.2 spec/acceptance/recode_spec.rb
galakei-0.13.1 spec/acceptance/recode_spec.rb
galakei-0.13.0 spec/acceptance/recode_spec.rb
galakei-0.12.1 spec/acceptance/recode_spec.rb
galakei-0.12.0 spec/acceptance/recode_spec.rb