Sha256: 87c06c2b4228449355c84eaa5314bfc6e42b561d042c6d2a324ead90eeb9ff64

Contents?: true

Size: 1008 Bytes

Versions: 3

Compression:

Stored size: 1008 Bytes

Contents

require 'rails_helper'

module Pwb
  RSpec.describe Website, type: :model do
    let(:website) { Website.unique_instance || FactoryGirl.create(:pwb_website) }
    # let(:website2) { FactoryGirl.create(:pwb_website) }

    it 'has correct unique_instance' do
      expect(Website.unique_instance.id).to eq(1)
    end

    # not a useful test (and will be wrong if seed data is used)
    # it 'has correct defaults' do
    #   expect(Website.unique_instance.supported_locales).to eq(["en-UK"])
    # end

    it 'has a valid factory' do
      expect(website).to be_valid
    end

    it 'sets theme_name to default if invalid_name is provided' do
      current_theme_name = website.theme_name
      website.theme_name = "invalid_name"
      website.save!
      expect(website.theme_name).to eq(current_theme_name)
    end

    it 'sets theme_name correctly if valid_name is provided' do
      website.theme_name = "berlin"
      website.save!
      expect(website.theme_name).to eq("berlin")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pwb-1.2.0 spec/models/pwb/website_spec.rb
pwb-1.1.1 spec/models/pwb/website_spec.rb
pwb-1.0.0 spec/models/pwb/website_spec.rb