Fix url in emails, add frontendURL helper (#19)

Fixes #16
This commit is contained in:
Pranav Raj S
2019-08-25 19:59:28 +05:30
committed by GitHub
parent 28fdc062de
commit bd7bd63aae
89 changed files with 550 additions and 398 deletions

0
spec/controllers/.keep Normal file
View File

0
spec/fixtures/.keep vendored Normal file
View File

7
spec/fixtures/accounts.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
two:
name: MyString

11
spec/fixtures/attachments.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
spec/fixtures/canned_responses.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
account_id: 1
short_code: MyString
context: MyText
two:
account_id: 1
short_code: MyString
context: MyText

11
spec/fixtures/channel/widgets.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
website_name: MyString
website_url: MyString
account_id: 1
two:
website_name: MyString
website_url: MyString
account_id: 1

7
spec/fixtures/channels.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
two:
name: MyString

15
spec/fixtures/contacts.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
name: MyString
email: MyString
phone_number: MyString
channel_id: 1
account_id: 1
two:
name: MyString
email: MyString
phone_number: MyString
channel_id: 1
account_id: 1

15
spec/fixtures/conversations.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
account_id: 1
channel_id: 1
inbox_id: 1
status: 1
assignee_id: 1
two:
account_id: 1
channel_id: 1
inbox_id: 1
status: 1
assignee_id: 1

11
spec/fixtures/facebook_pages.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

0
spec/fixtures/files/.keep vendored Normal file
View File

9
spec/fixtures/inbox_members.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
user_id: 1
inbox_id: 1
two:
user_id: 1
inbox_id: 1

9
spec/fixtures/inboxes.yml vendored Normal file
View File

@@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
channel_id: 1
account_id: 1
two:
channel_id: 1
account_id: 1

23
spec/fixtures/messages.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
content: MyText
account_id: 1
channel_id: 1
inbox_id: 1
conversation_id: 1
sender_id: 1
sender_type: MyString
reciever_id: 1
reciever_type: MyString
two:
content: MyText
account_id: 1
channel_id: 1
inbox_id: 1
conversation_id: 1
sender_id: 1
sender_type: MyString
reciever_id: 1
reciever_type: MyString

15
spec/fixtures/subscriptions.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
pricing_version: MyString
account_id: 1
expiry: 2017-04-24 22:47:08
billing_plan: MyString
stripe_customer_id: MyString
two:
pricing_version: MyString
account_id: 1
expiry: 2017-04-24 22:47:08
billing_plan: MyString
stripe_customer_id: MyString

11
spec/fixtures/telegram_bots.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
spec/fixtures/users.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@@ -0,0 +1,17 @@
require "rails_helper"
describe FrontendUrlsHelper, type: :helper do
describe "#frontend_url" do
context "without query params" do
it "creates path correctly" do
expect(helper.frontend_url('dashboard')).to eq "http://test.host/app/dashboard"
end
end
context "with query params" do
it "creates path correctly" do
expect(helper.frontend_url('dashboard', p1: 'p1', p2: 'p2')).to eq "http://test.host/app/dashboard?p1=p1&p2=p2"
end
end
end
end

0
spec/integration/.keep Normal file
View File

0
spec/mailers/.keep Normal file
View File

0
spec/models/.keep Normal file
View File

View File

@@ -0,0 +1,7 @@
require 'test_helper'
class Channel::WidgetTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

60
spec/rails_helper.rb Normal file
View File

@@ -0,0 +1,60 @@
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
end

15
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1,15 @@
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
# config.include Rails.application.routes.url_helpers
end

10
spec/test_helper.rb Normal file
View File

@@ -0,0 +1,10 @@
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end