You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -72,9 +73,16 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
72
73
* /spec/react_on_rails/dummy-for-generators
73
74
74
75
# Configuring your test app to use your local fork
76
+
You can test the `react-on-rails` gem using your own external test app or the gem's internal `spec/dummy` app. The `spec/dummy` app is an example of the various setup techniques you can use with the gem.
77
+
```
78
+
├── test
79
+
└── react_on_rails
80
+
└── spec
81
+
└── dummy
82
+
```
75
83
76
84
## Ruby Gem
77
-
If you want to test the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:
85
+
If you want to test the ruby parts of the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:
@@ -86,13 +94,14 @@ Note that you will need to bundle install after making this change, but also tha
86
94
First, be **sure** to build the NPM package
87
95
88
96
```sh
97
+
cd react_on_rails/
89
98
yarn
90
99
yarn run build
91
100
```
92
101
93
-
Use a relative path in your `package.json`, like this:
102
+
Use a relative path in your test app's `package.json`, like this:
94
103
```sh
95
-
cd client
104
+
cdtest/client
96
105
yarn add "react-on-rails@../../react_on_rails"
97
106
```
98
107
@@ -119,9 +128,10 @@ yarn global add phantomjs
119
128
Note this *must* be installed globally for the dummy test project rspec runner to see it properly.
120
129
121
130
### Local Node Package
122
-
Because the example and dummy apps rely on the react-on-rails node package, they should link directly to your local version to pick up any changes you may have made to that package. To achieve this, switch to the test app's root directory and run this command below which runs something like [this script](spec/dummy/package.json#L14)
131
+
Because the example and dummy apps rely on the react-on-rails node package, they should link directly to your local version to pick up any changes you may have made to that package. To achieve this, switch to the dummy app's root directory and run this command below which runs something like [this script](spec/dummy/package.json#L14)
123
132
124
133
```sh
134
+
cd react_on_rails/spec/dummy
125
135
yarn run install-react-on-rails
126
136
```
127
137
@@ -141,9 +151,9 @@ From now on, the example and dummy apps will use your local node_package folder
141
151
### Install NPM dependencies and build the NPM package for react-on-rails
142
152
143
153
```sh
144
-
cd<top level>
154
+
cdreact_on_rails/
145
155
yarn
146
-
npm build
156
+
yarn build
147
157
```
148
158
149
159
Or run this which builds the yarn package, then the webpack files for spec/dummy, and runs tests in
To run the test app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start`. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
199
+
To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start`. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
190
200
191
201
### RSpec Testing
192
202
Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.
0 commit comments