Skip to content
RSpec matchers for ruby 1.9 string encoding
Ruby
Find file
Failed to load latest commit information.
lib Real version.
spec Add specs for should_not
.autotest Rspec added with lots of tests.
.gitignore Add lock file to git ignore
.rspec Rspec added with lots of tests.
.rvmrc Add .rvmrc file
Gemfile Gem files from bundler
README.md
Rakefile Gem files from bundler
rspec-encoding-matchers.gemspec Real values for gemspec

README.md

RSpec Encoding Matchers

Provides RSpec matchers for Ruby 1.9 string encoding.

Installation

gem install rspec-encoding-matchers

Then require the gem:

require 'rspec_encoding_matchers'

Configuration

To use the custom matchers, include the matcher module either in an example group:

describe "my group" do
  include RSpecEncodingMatchers
  it "is encoded in UTF-8" do
    hello.should be_encoded_as("UTF-8")
  end
end

Or you can include the module in your RSpec configuration.

# spec_helper.rb
RSpec.configure do |config|
  config.color_enabled = true
  config.include RSpecEncodingMatchers
end

Usage

RSpecEncodingMatchers provides two types of matchers. The first type, be_encoded_as, matches to see if the subject is the encoding passed in as a parameter.

"my string".should be_encoded_as("UTF-8")

RSpecEncodingMatchers also provides built in matchers for all known string encodings (and their alternate names) to Ruby. For example:

"my string".should be_iso_8859_1_encoded

Presently, the following built in encoding matchers are available.

  • be_ascii_8bit_encoded
  • be_binary_encoded
  • be_utf_8_encoded
  • be_cp65001_encoded
  • be_locale_encoded
  • be_external_encoded
  • be_filesystem_encoded
  • be_us_ascii_encoded
  • be_ascii_encoded
  • be_ansi_x3.4_1968_encoded
  • be_646_encoded
  • be_big5_encoded
  • be_cp950_encoded
  • be_big5_hkscs_encoded
  • be_cp951_encoded
  • be_big5_uao_encoded
  • be_cp949_encoded
  • be_emacs_mule_encoded
  • be_euc_jp_encoded
  • be_eucjp_encoded
  • be_euc_kr_encoded
  • be_euckr_encoded
  • be_euc_tw_encoded
  • be_euctw_encoded
  • be_gb18030_encoded
  • be_gbk_encoded
  • be_cp936_encoded
  • be_iso_8859_1_encoded
  • be_iso8859_1_encoded
  • be_iso_8859_2_encoded
  • be_iso8859_2_encoded
  • be_iso_8859_3_encoded
  • be_iso8859_3_encoded
  • be_iso_8859_4_encoded
  • be_iso8859_4_encoded
  • be_iso_8859_5_encoded
  • be_iso8859_5_encoded
  • be_iso_8859_6_encoded
  • be_iso8859_6_encoded
  • be_iso_8859_7_encoded
  • be_iso8859_7_encoded
  • be_iso_8859_8_encoded
  • be_iso8859_8_encoded
  • be_iso_8859_9_encoded
  • be_iso8859_9_encoded
  • be_iso_8859_10_encoded
  • be_iso8859_10_encoded
  • be_iso_8859_11_encoded
  • be_iso8859_11_encoded
  • be_iso_8859_13_encoded
  • be_iso8859_13_encoded
  • be_iso_8859_14_encoded
  • be_iso8859_14_encoded
  • be_iso_8859_15_encoded
  • be_iso8859_15_encoded
  • be_iso_8859_16_encoded
  • be_iso8859_16_encoded
  • be_koi8_r_encoded
  • be_cp878_encoded
  • be_koi8_u_encoded
  • be_shift_jis_encoded
  • be_sjis_encoded
  • be_utf_16be_encoded
  • be_ucs_2be_encoded
  • be_utf_16le_encoded
  • be_utf_32be_encoded
  • be_ucs_4be_encoded
  • be_utf_32le_encoded
  • be_ucs_4le_encoded
  • be_windows_1251_encoded
  • be_cp1251_encoded
  • be_ibm437_encoded
  • be_cp437_encoded
  • be_ibm737_encoded
  • be_cp737_encoded
  • be_ibm775_encoded
  • be_cp775_encoded
  • be_cp850_encoded
  • be_ibm850_encoded
  • be_ibm852_encoded
  • be_cp852_encoded
  • be_ibm855_encoded
  • be_cp855_encoded
  • be_ibm857_encoded
  • be_cp857_encoded
  • be_ibm860_encoded
  • be_cp860_encoded
  • be_ibm861_encoded
  • be_cp861_encoded
  • be_ibm862_encoded
  • be_cp862_encoded
  • be_ibm863_encoded
  • be_cp863_encoded
  • be_ibm864_encoded
  • be_cp864_encoded
  • be_ibm865_encoded
  • be_cp865_encoded
  • be_ibm866_encoded
  • be_cp866_encoded
  • be_ibm869_encoded
  • be_cp869_encoded
  • be_windows_1258_encoded
  • be_cp1258_encoded
  • be_gb1988_encoded
  • be_maccenteuro_encoded
  • be_maccroatian_encoded
  • be_maccyrillic_encoded
  • be_macgreek_encoded
  • be_maciceland_encoded
  • be_macroman_encoded
  • be_macromania_encoded
  • be_macthai_encoded
  • be_macturkish_encoded
  • be_macukraine_encoded
  • be_stateless_iso_2022_jp_encoded
  • be_eucjp_ms_encoded
  • be_euc_jp_ms_encoded
  • be_cp51932_encoded
  • be_gb2312_encoded
  • be_euc_cn_encoded
  • be_euccn_encoded
  • be_gb12345_encoded
  • be_iso_2022_jp_encoded
  • be_iso2022_jp_encoded
  • be_iso_2022_jp_2_encoded
  • be_iso2022_jp2_encoded
  • be_cp50220_encoded
  • be_cp50221_encoded
  • be_windows_1252_encoded
  • be_cp1252_encoded
  • be_windows_1250_encoded
  • be_cp1250_encoded
  • be_windows_1256_encoded
  • be_cp1256_encoded
  • be_windows_1253_encoded
  • be_cp1253_encoded
  • be_windows_1255_encoded
  • be_cp1255_encoded
  • be_windows_1254_encoded
  • be_cp1254_encoded
  • be_tis_620_encoded
  • be_windows_874_encoded
  • be_cp874_encoded
  • be_windows_1257_encoded
  • be_cp1257_encoded
  • be_windows_31j_encoded
  • be_cp932_encoded
  • be_cswindows31j_encoded
  • be_macjapanese_encoded
  • be_macjapan_encoded
  • be_utf_7_encoded
  • be_cp65000_encoded
  • be_utf8_mac_encoded
  • be_utf_8_mac_encoded
  • be_utf_8_hfs_encoded
  • be_utf8_docomo_encoded
  • be_sjis_docomo_encoded
  • be_utf8_kddi_encoded
  • be_sjis_kddi_encoded
  • be_iso_2022_jp_kddi_encoded
  • be_stateless_iso_2022_jp_kddi_encoded
  • be_utf8_softbank_encoded
  • be_sjis_softbank_encoded
Something went wrong with that request. Please try again.