Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for issue #75 #89

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -261,6 +261,10 @@ Broadly speaking, these initiatives are on our roadmap:

Bug reports and pull requests are welcome on GitHub at https://github.com/unabridged/motion.

### Setup
To develop Motion locally, be sure to use one of the Ruby versions listed under the `rvm` key in `.travis.yml`.

To run tests, run `bin/rake test`.

## License

Expand Down
@@ -0,0 +1,4 @@
<div>
<div><%= num_ticks %> ticks</div>
<div><%= url_for(only_path: false) %></div>
</div>
@@ -0,0 +1,17 @@
# frozen_string_literal: true

class CurrentDomainComponent < ViewComponent::Base
include Motion::Component

attr_reader :num_ticks

def initialize
@num_ticks = 0
end

every 5.seconds, :tick

def tick
@num_ticks += 1
end
end
@@ -1,6 +1,11 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base

# def default_url_options
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is set, you need to assert that www.example.com appears in the output before and after the ticks, and if you make that change, the tests still pass.

# {:host => "www.example.com"}
# end

private

# Rendering the component inline like this causes the application layout to
Expand Down
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class CurrentDomainComponentsController < ApplicationController
def show
render_component_in_layout(CurrentDomainComponent.new)
end
end
1 change: 1 addition & 0 deletions spec/support/test_application/config/routes.rb
Expand Up @@ -5,6 +5,7 @@
resource :timer_component, only: :show
resource :test_component, only: :show
resource :callback_component, only: :show
resource :current_domain_component, only: :show

resources :dogs, only: [:new, :create]
end
8 changes: 8 additions & 0 deletions spec/system/core_functionality_spec.rb
Expand Up @@ -95,4 +95,12 @@

expect(page).to have_text("The count is 2")
end

scenario "Domain in links are preserved after re-renders" do
visit(current_domain_component_path)
wait_for_connect
expect(page).to have_text("127.0.0.1")
sleep 2
expect(page).to have_text("127.0.0.1")
end
end