Sha256: b823ec42201fbdbd755ddbad36e3d84cf3dc6b72ee88cc4b26b6099f06b577fb
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Emojimmy::Mixin do describe :inject_methods do before do run_migration do create_table(:comments, force: true) do |t| t.text :body end end spawn_emojimmy_model 'Comment', in: [:body] end describe :InstanceMethod do subject { Comment.create(body: body) } context 'with a single emoji' do let(:body) { "Hello, 😁😁 world!" } it { should be_persisted } its(:body) { should eql body } end context 'with multiple emoji' do let(:body) { "Hello, 😁😁😁 😍 world!" } it { should be_persisted } its(:body) { should eql body } end context 'without any emoji' do let(:body) { "Hello, boring world!" } it { should be_persisted } its(:body) { should eql body } end end describe :Callback do subject { Comment.create(body: body) } let(:persisted_body) { subject.read_attribute(:body) } context 'with a single emoji' do let(:body) { "Hello, 😁 world!" } it { should be_persisted } it { expect(persisted_body).to eql "Hello, {U+1F601} world!" } end context 'with multiple emoji' do let(:body) { "Hello, 😁😁 😍 world!" } it { should be_persisted } it { expect(persisted_body).to eql "Hello, {U+1F601}{U+1F601} {U+1F60D} world!" } end context 'without any emoji' do let(:body) { "Hello, boring world!" } it { should be_persisted } it { expect(persisted_body).to eql "Hello, boring world!" } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
emojimmy-0.1.2 | spec/emojimmy/mixin_spec.rb |